EMF DiffMerge/Programmatic Usage/Generic API
As mentioned in  and , 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 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 instead of EReference
- IAttributeValuePresence::getFeature() : Object instead of EAttribute
- IDiffPolicy::coverOutOfScopeValue(...) takes an additional ITreeDataScope arg
- IPersistentModelScope::getRawContents() -> IPersistentDataScope::getRawRoots()
- IPersistentModelScope::get/setExtrinsicID(...) -> IDataScope::tGetID(...)/tSetID(...)