Package org.eclipse.aether.graph
Class DefaultDependencyNode
java.lang.Object
org.eclipse.aether.graph.DefaultDependencyNode
- All Implemented Interfaces:
DependencyNode
A node within a dependency graph.
-
Field Summary
Fields inherited from interface org.eclipse.aether.graph.DependencyNode
MANAGED_EXCLUSIONS, MANAGED_OPTIONAL, MANAGED_PROPERTIES, MANAGED_SCOPE, MANAGED_VERSION
-
Constructor Summary
ConstructorDescriptionDefaultDependencyNode
(Artifact artifact) Creates a new root node with the specified artifact as its label.DefaultDependencyNode
(Dependency dependency) Creates a new node with the specified dependency.Creates a mostly shallow clone of the specified node. -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(DependencyVisitor visitor) Traverses this node and potentially its children using the specified visitor.Collection<? extends Artifact>
Gets the known aliases for this dependency's artifact.Gets the artifact associated with this node.Gets the child nodes of this node.getData()
Gets the custom data associated with this dependency node.Gets the dependency associated with this node.int
Gets a bit field indicating which attributes of this node were subject to dependency management.Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.Gets the remote repositories from which this node's artifact shall be resolved.Gets the request context in which this dependency node was created.Gets the version that was selected for the dependency's target artifact.Gets the version constraint that was parsed from the dependency's version declaration.void
setAliases
(Collection<? extends Artifact> aliases) Sets the known aliases for this dependency's artifact.void
setArtifact
(Artifact artifact) Updates the artifact of the dependency after resolution.void
setChildren
(List<DependencyNode> children) Sets the child nodes of this node.void
Associates the specified dependency node data with the given key.void
Sets the custom data associated with this dependency node.void
setManagedBits
(int managedBits) Sets a bit field indicating which attributes of this node were subject to dependency management.void
setOptional
(Boolean optional) Sets the optional flag of the dependency.void
setRelocations
(List<? extends Artifact> relocations) Sets the sequence of relocations that was followed to resolve this dependency's artifact.void
setRepositories
(List<RemoteRepository> repositories) Sets the remote repositories from which this node's artifact shall be resolved.void
setRequestContext
(String context) Sets the request context in which this dependency node was created.void
Sets the scope of the dependency.void
setVersion
(Version version) Sets the version that was selected for the dependency's target artifact.void
setVersionConstraint
(VersionConstraint versionConstraint) Sets the version constraint that was parsed from the dependency's version declaration.toString()
-
Constructor Details
-
DefaultDependencyNode
Creates a new node with the specified dependency.- Parameters:
dependency
- The dependency associated with this node, may benull
for a root node.
-
DefaultDependencyNode
Creates a new root node with the specified artifact as its label. Note that the new node has no dependency, i.e.getDependency()
will returnnull
. Put differently, the specified artifact will not be subject to dependency collection/resolution.- Parameters:
artifact
- The artifact to use as label for this node, may benull
.
-
DefaultDependencyNode
Creates a mostly shallow clone of the specified node. The new node has its own copy of any custom data and initially no children.- Parameters:
node
- The node to copy, must not benull
.
-
-
Method Details
-
getChildren
Description copied from interface:DependencyNode
Gets the child nodes of this node. To conserve memory, dependency nodes with equal dependencies may share the same child list instance. Hence clients mutating the child list need to be aware that these changes might affect more than this node. Where this is not desired, the child list should be copied before mutation if the client cannot be sure whether it might be shared with other nodes in the graph.- Specified by:
getChildren
in interfaceDependencyNode
- Returns:
- The child nodes of this node, never
null
.
-
setChildren
Description copied from interface:DependencyNode
Sets the child nodes of this node.- Specified by:
setChildren
in interfaceDependencyNode
- Parameters:
children
- The child nodes, may benull
-
getDependency
Description copied from interface:DependencyNode
Gets the dependency associated with this node. Note: For dependency graphs that have been constructed without a root dependency, this method will yieldnull
when invoked on the graph's root node. The root node of such graphs may however still have a label as returned byDependencyNode.getArtifact()
.- Specified by:
getDependency
in interfaceDependencyNode
- Returns:
- The dependency or
null
if none.
-
getArtifact
Description copied from interface:DependencyNode
Gets the artifact associated with this node. If this node is associated with a dependency, this is equivalent togetDependency().getArtifact()
. Otherwise the artifact merely provides a label for this node in which case the artifact must not be subjected to dependency collection/resolution.- Specified by:
getArtifact
in interfaceDependencyNode
- Returns:
- The associated artifact or
null
if none.
-
setArtifact
Description copied from interface:DependencyNode
Updates the artifact of the dependency after resolution. The new artifact must have the same coordinates as the original artifact. This method may only be invoked if this node actually has a dependency, i.e. ifDependencyNode.getDependency()
is not null.- Specified by:
setArtifact
in interfaceDependencyNode
- Parameters:
artifact
- The artifact satisfying the dependency, must not benull
.
-
getRelocations
Description copied from interface:DependencyNode
Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.- Specified by:
getRelocations
in interfaceDependencyNode
- Returns:
- The (read-only) sequence of relocations, never
null
.
-
setRelocations
Sets the sequence of relocations that was followed to resolve this dependency's artifact.- Parameters:
relocations
- The sequence of relocations, may benull
.
-
getAliases
Description copied from interface:DependencyNode
Gets the known aliases for this dependency's artifact. An alias can be used to mark a patched rebuild of some other artifact as such, thereby allowing conflict resolution to consider the patched and the original artifact as a conflict.- Specified by:
getAliases
in interfaceDependencyNode
- Returns:
- The (read-only) set of known aliases, never
null
.
-
setAliases
Sets the known aliases for this dependency's artifact.- Parameters:
aliases
- The known aliases, may benull
.
-
getVersionConstraint
Description copied from interface:DependencyNode
Gets the version constraint that was parsed from the dependency's version declaration.- Specified by:
getVersionConstraint
in interfaceDependencyNode
- Returns:
- The version constraint for this node or
null
.
-
setVersionConstraint
Sets the version constraint that was parsed from the dependency's version declaration.- Parameters:
versionConstraint
- The version constraint for this node, may benull
.
-
getVersion
Description copied from interface:DependencyNode
Gets the version that was selected for the dependency's target artifact.- Specified by:
getVersion
in interfaceDependencyNode
- Returns:
- The parsed version or
null
.
-
setVersion
Sets the version that was selected for the dependency's target artifact.- Parameters:
version
- The parsed version, may benull
.
-
setScope
Description copied from interface:DependencyNode
Sets the scope of the dependency. This method may only be invoked if this node actually has a dependency, i.e. ifDependencyNode.getDependency()
is not null.- Specified by:
setScope
in interfaceDependencyNode
- Parameters:
scope
- The scope, may benull
.
-
setOptional
Description copied from interface:DependencyNode
Sets the optional flag of the dependency. This method may only be invoked if this node actually has a dependency, i.e. ifDependencyNode.getDependency()
is not null.- Specified by:
setOptional
in interfaceDependencyNode
- Parameters:
optional
- The optional flag, may benull
.
-
getManagedBits
Description copied from interface:DependencyNode
Gets a bit field indicating which attributes of this node were subject to dependency management.- Specified by:
getManagedBits
in interfaceDependencyNode
- Returns:
- A bit field containing any of the bits
DependencyNode.MANAGED_VERSION
,DependencyNode.MANAGED_SCOPE
,DependencyNode.MANAGED_OPTIONAL
,DependencyNode.MANAGED_PROPERTIES
andDependencyNode.MANAGED_EXCLUSIONS
if the corresponding attribute was set via dependency management.
-
setManagedBits
Sets a bit field indicating which attributes of this node were subject to dependency management.- Parameters:
managedBits
- The bit field indicating the managed attributes or0
if dependency management wasn't applied.
-
getRepositories
Description copied from interface:DependencyNode
Gets the remote repositories from which this node's artifact shall be resolved.- Specified by:
getRepositories
in interfaceDependencyNode
- Returns:
- The (read-only) list of remote repositories to use for artifact resolution, never
null
.
-
setRepositories
Sets the remote repositories from which this node's artifact shall be resolved.- Parameters:
repositories
- The remote repositories to use for artifact resolution, may benull
.
-
getRequestContext
Description copied from interface:DependencyNode
Gets the request context in which this dependency node was created.- Specified by:
getRequestContext
in interfaceDependencyNode
- Returns:
- The request context, never
null
.
-
setRequestContext
Description copied from interface:DependencyNode
Sets the request context in which this dependency node was created.- Specified by:
setRequestContext
in interfaceDependencyNode
- Parameters:
context
- The context, may benull
.
-
getData
Description copied from interface:DependencyNode
Gets the custom data associated with this dependency node. Clients of the repository system can use this data to annotate dependency nodes with domain-specific information. Note that the returned map is read-only andDependencyNode.setData(Object, Object)
needs to be used to update the custom data.- Specified by:
getData
in interfaceDependencyNode
- Returns:
- The (read-only) key-value mappings, never
null
.
-
setData
Description copied from interface:DependencyNode
Sets the custom data associated with this dependency node.- Specified by:
setData
in interfaceDependencyNode
- Parameters:
data
- The new custom data, may benull
.
-
setData
Description copied from interface:DependencyNode
Associates the specified dependency node data with the given key. Note: This method must not be called whileDependencyNode.getData()
is being iterated.- Specified by:
setData
in interfaceDependencyNode
- Parameters:
key
- The key under which to store the data, must not benull
.value
- The data to associate with the key, may benull
to remove the mapping.
-
accept
Description copied from interface:DependencyNode
Traverses this node and potentially its children using the specified visitor.- Specified by:
accept
in interfaceDependencyNode
- Parameters:
visitor
- The visitor to call back, must not benull
.- Returns:
true
to visit siblings nodes of this node as well,false
to skip siblings.
-
toString
-