Frage

Version of EMF Compare: 2.1.0 M6 (2013/03/19 17:50)

I am trying to use standalone compare as explained in this guide. I get the below compilation error

The method setMatchEngine(IMatchEngine) is undefined for the type EMFCompare.Builder

for the below code

// Configure EMF Compare
IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.NEVER);
IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
IMatchEngine matchEngine = new DefaultMatchEngine(matcher, comparisonFactory);
EMFCompare comparator = EMFCompare.builder().setMatchEngine(matchEngine).build();

I see that setMatchEngine is replaced by some other API as shown in the below figure. I am not sure how to specify the new matchEngine using that API.

enter image description here

War es hilfreich?

Lösung

These APIs have changed for M6 (the API are now in their final 2.1.0 stage as far as removals are concerned). A good source of "how to use the APIs" are the unit tests of EMF Compare if you have the code in your workspace.

For your particular use case, the code would look as such:

IMatchEngine.Factory factory = new MatchEngineFactoryImpl(UseIdentifiers.NEVER);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry .add(factory);
EMFCompare comparator = EMFCompare.builder().setMatchEngineFactoryRegistry(matchEngineRegistry).build();

Note that using the default registry (EMFCompare.builder().build();) would be enough in most cases... except when you really can't let EMF Compare use the IDs :p.

[edit: a small note: we have now updated the wiki with accurate information, thanks for the feedback ;)]

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top