Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EMF DiffMerge/Programmatic Usage/Generic API"

(Created page with "As mentioned in [https://www.eclipse.org/lists/diffmerge-dev/msg00041.html] and [https://www.eclipse.org/forums/index.php/t/1102433/], EMF Diff/Merge will soon include 'generi...")
 
(Main changes)
Line 10: Line 10:
 
* Most interfaces have a type parameter that represents the type of data elements, e.g., EObject. For example: IComparison<E>, IMatchPolicy<E>.
 
* Most interfaces have a type parameter that represents the type of data elements, e.g., EObject. For example: IComparison<E>, IMatchPolicy<E>.
 
* The application of these 'generic' APIs to EMF is still in plug-in org.eclipse.emf.diffmerge.
 
* The application of these 'generic' APIs to EMF is still in plug-in org.eclipse.emf.diffmerge.
* The hierarchy of scopes is modified: although IModelScope and sub-interfaces / implementing classes still exist in org.eclipse.emf.diffmerge, they extend 'generic' interfaces from org.eclipse.emf.diffmerge.generic. Those extend IDataScope and  ITreeDataScope is the most useful. In many cases, it is more convenient to use ITreeDataScope<EObject> than IModelScope.
+
* The hierarchy of scopes is modified: although IModelScope and sub-interfaces / implementing classes still exist in org.eclipse.emf.diffmerge, they extend 'generic' interfaces from org.eclipse.emf.diffmerge.generic. Those extend IDataScope, and  ITreeDataScope is the most useful. In many cases, it is more convenient to use ITreeDataScope<EObject> than IModelScope.
 
* The rules that govern data integrity and consistent manipulations are defined through IDataPolicy.
 
* The rules that govern data integrity and consistent manipulations are defined through IDataPolicy.
  

Revision as of 11:10, 2 April 2020

As mentioned in [1] and [2], EMF Diff/Merge will soon include 'generic' APIs and corresponding implementations that extend its applicability to non-EMF data (POJOs) whose integrity/consistency constraints are close to those that govern EMF instance models.

All of this is currently available in branch 'generic' and is planned to be merged into 'master' in 2020.

This page aims at helping migrate existing code to the new APIs.

Main changes

  • Main APIs are now in plug-in 'org.eclipse.emf.diffmerge.generic'. Java packages follow this change in the sense that all APIs are now in package 'org.eclipse.emf.diffmerge.generic.api'. For example: IComparison, IMatch, IDifference, IMatchPolicy, IDiffPolicy, etc. Imports must thus be updated accordingly.
  • Most interfaces have a type parameter that represents the type of data elements, e.g., EObject. For example: IComparison<E>, IMatchPolicy<E>.
  • The application of these 'generic' APIs to EMF is still in plug-in org.eclipse.emf.diffmerge.
  • The hierarchy of scopes is modified: although IModelScope and sub-interfaces / implementing classes still exist in org.eclipse.emf.diffmerge, they extend 'generic' interfaces from org.eclipse.emf.diffmerge.generic. Those extend IDataScope, and ITreeDataScope is the most useful. In many cases, it is more convenient to use ITreeDataScope<EObject> than IModelScope.
  • The rules that govern data integrity and consistent manipulations are defined through IDataPolicy.

Notable fine-grained changes

  • IModelScope::getContents() -> ITreeDataScope<E>::getRoots()
  • IModelScope::getAllContents() -> ITreeDataScope<E>::iterator()
  • IModelScope::getAllContentsAsSet() -> IModelScope::getAllContentsAsSet
  • IReferenceValuePresence::getFeature() : Object
  • IAttributeValuePresence::getFeature() : Object
  • IDiffPolicy::coverOutOfScopeValue(...) takes an additional ITreeDataScope arg
  • IPersistentModelScope::getRawContents() -> IPersistentDataScope::getRawRoots()
  • IPersistentModelScope::get/setExtrinsicID(...) -> IDataScope::tGetID(...)/tSetID(...)

Back to the top