Package org.eclipse.aether.graph
Interface DependencyNode
- All Known Implementing Classes:
DefaultDependencyNode
public interface DependencyNode
A node within a dependency graph. To conserve memory, dependency graphs may reuse a given node instance multiple
times to represent reoccurring dependencies. As such clients traversing a dependency graph should be prepared to
discover multiple paths leading to the same node instance unless the input graph is known to be a duplicate-free
tree. Note: Unless otherwise noted, implementation classes are not thread-safe and dependency nodes should
not be mutated by concurrent threads.
- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
A bit flag indicating the exclusions were subject to dependency managementstatic final int
A bit flag indicating the optional flag was subject to dependency managementstatic final int
A bit flag indicating the artifact properties were subject to dependency managementstatic final int
A bit flag indicating the dependency scope was subject to dependency managementstatic final int
A bit flag indicating the dependency version was subject to dependency management -
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.Map
<?, ?> 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
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
setOptional
(Boolean optional) Sets the optional flag of the dependency.void
setRequestContext
(String context) Sets the request context in which this dependency node was created.void
Sets the scope of the dependency.
-
Field Details
-
MANAGED_VERSION
A bit flag indicating the dependency version was subject to dependency management- See Also:
-
MANAGED_SCOPE
A bit flag indicating the dependency scope was subject to dependency management- See Also:
-
MANAGED_OPTIONAL
A bit flag indicating the optional flag was subject to dependency management- See Also:
-
MANAGED_PROPERTIES
A bit flag indicating the artifact properties were subject to dependency management- See Also:
-
MANAGED_EXCLUSIONS
A bit flag indicating the exclusions were subject to dependency management- See Also:
-
-
Method Details
-
getChildren
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.- Returns:
- The child nodes of this node, never
null
.
-
setChildren
Sets the child nodes of this node.- Parameters:
children
- The child nodes, may benull
-
getDependency
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 bygetArtifact()
.- Returns:
- The dependency or
null
if none.
-
getArtifact
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.- Returns:
- The associated artifact or
null
if none.
-
setArtifact
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. ifgetDependency()
is not null.- Parameters:
artifact
- The artifact satisfying the dependency, must not benull
.
-
getRelocations
List<? extends Artifact> getRelocations()Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.- Returns:
- The (read-only) sequence of relocations, never
null
.
-
getAliases
Collection<? extends Artifact> getAliases()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.- Returns:
- The (read-only) set of known aliases, never
null
.
-
getVersionConstraint
Gets the version constraint that was parsed from the dependency's version declaration.- Returns:
- The version constraint for this node or
null
.
-
getVersion
Gets the version that was selected for the dependency's target artifact.- Returns:
- The parsed version or
null
.
-
setScope
Sets the scope of the dependency. This method may only be invoked if this node actually has a dependency, i.e. ifgetDependency()
is not null.- Parameters:
scope
- The scope, may benull
.
-
setOptional
Sets the optional flag of the dependency. This method may only be invoked if this node actually has a dependency, i.e. ifgetDependency()
is not null.- Parameters:
optional
- The optional flag, may benull
.
-
getManagedBits
int getManagedBits()Gets a bit field indicating which attributes of this node were subject to dependency management.- Returns:
- A bit field containing any of the bits
MANAGED_VERSION
,MANAGED_SCOPE
,MANAGED_OPTIONAL
,MANAGED_PROPERTIES
andMANAGED_EXCLUSIONS
if the corresponding attribute was set via dependency management.
-
getRepositories
Gets the remote repositories from which this node's artifact shall be resolved.- Returns:
- The (read-only) list of remote repositories to use for artifact resolution, never
null
.
-
getRequestContext
Gets the request context in which this dependency node was created.- Returns:
- The request context, never
null
.
-
setRequestContext
Sets the request context in which this dependency node was created.- Parameters:
context
- The context, may benull
.
-
getData
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 andsetData(Object, Object)
needs to be used to update the custom data.- Returns:
- The (read-only) key-value mappings, never
null
.
-
setData
Sets the custom data associated with this dependency node.- Parameters:
data
- The new custom data, may benull
.
-
setData
Associates the specified dependency node data with the given key. Note: This method must not be called whilegetData()
is being iterated.- 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
Traverses this node and potentially its children using the specified visitor.- 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.
-