public abstract static class ConflictResolver.VersionSelector extends Object
ConflictResolver
that determines the winner among conflicting dependencies. The
winning node (and its children) will be retained in the dependency graph, the other nodes will get removed. The
version selector does not need to deal with potential scope conflicts, these will be addressed afterwards by the
ConflictResolver.ScopeSelector
.
Note: Implementations must be stateless.
Constructor and Description |
---|
VersionSelector() |
Modifier and Type | Method and Description |
---|---|
ConflictResolver.VersionSelector |
getInstance(DependencyNode root,
DependencyGraphTransformationContext context)
Retrieves the version selector for use during the specified graph transformation.
|
abstract void |
selectVersion(ConflictResolver.ConflictContext context)
Determines the winning node among conflicting dependencies.
|
public VersionSelector()
public ConflictResolver.VersionSelector getInstance(DependencyNode root, DependencyGraphTransformationContext context) throws RepositoryException
ConflictResolver.transformGraph(DependencyNode, DependencyGraphTransformationContext)
invocation to
allow implementations to prepare any auxiliary data that is needed for their operation. Given that
implementations must be stateless, a new instance needs to be returned to hold such auxiliary data. The
default implementation simply returns the current instance which is appropriate for implementations which do
not require auxiliary data.root
- The root node of the (possibly cyclic!) graph to transform, must not be null
.context
- The graph transformation context, must not be null
.null
.RepositoryException
- If the instance could not be retrieved.public abstract void selectVersion(ConflictResolver.ConflictContext context) throws RepositoryException
ConflictResolver.ConflictContext.getItems()
, inspect ConflictResolver.ConflictItem.getNode()
and eventually call
ConflictResolver.ConflictContext.setWinner(ConflictResolver.ConflictItem)
to deliver the winner. Failure to select a
winner will automatically fail the entire conflict resolution.context
- The conflict context, must not be null
.RepositoryException
- If the version selection failed.Copyright © 2010–2022 The Apache Software Foundation. All rights reserved.