public class RootIDMatchingStrategy extends Object implements IResourceMatchingStrategy
Constructor and Description |
---|
RootIDMatchingStrategy() |
Modifier and Type | Method and Description |
---|---|
protected MatchResource |
createMatchResource(Resource left,
Resource right,
Resource origin)
Creates a
MatchResource instance and sets all three resources of the mapping on it. |
protected Resource |
findMatch(Resource reference,
Iterable<Resource> candidates)
Deprecated.
use
findMatches(Resource, Iterable) instead. |
protected List<Resource> |
findMatches(Resource reference,
Iterable<Resource> candidates)
Returns the first two matches of
reference in candidates . |
protected Set<String> |
getResourceIdentifiers(Resource resource)
Retrieves the set of identifiers for the given resource's root.
|
List<MatchResource> |
matchResources(Iterable<? extends Resource> left,
Iterable<? extends Resource> right,
Iterable<? extends Resource> origin)
Matches the given resources according to the IDs found in their roots.
|
public List<MatchResource> matchResources(Iterable<? extends Resource> left, Iterable<? extends Resource> right, Iterable<? extends Resource> origin)
When the root IDs of two resources intersect, they are considered as matching. This strategy will only return unique matches between all resources.
matchResources
in interface IResourceMatchingStrategy
left
- Resources we are to match in the left.right
- Resources we are to match in the right.origin
- Resources we are to match in the origin.protected List<Resource> findMatches(Resource reference, Iterable<Resource> candidates)
reference
in candidates
. This implementation
will consider two Resources to be "matches" if their roots have IDs, and these IDs intersect.
Subclasses may return more than two elements if considered useful.
reference
- The reference resource.candidates
- The list of potential candidates that may match reference
.reference
in candidates
. Empty list if none.@Deprecated protected Resource findMatch(Resource reference, Iterable<Resource> candidates)
findMatches(Resource, Iterable)
instead.reference
in candidates
. This implementation will
consider two Resources to be "matches" if their roots have IDs, and these IDs are the same.reference
- The reference resource.candidates
- The list of potential candidates that may match reference
.reference
in candidates
. null
if
none.protected Set<String> getResourceIdentifiers(Resource resource)
resource
- The resource for which we need the identifiers.protected MatchResource createMatchResource(Resource left, Resource right, Resource origin)
MatchResource
instance and sets all three resources of the mapping on it.left
- The left resource of this mapping.right
- The right resource of this mapping.origin
- The origin resource of this mapping.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.