public final class DefaultDependencyNode extends Object implements DependencyNode
MANAGED_EXCLUSIONS, MANAGED_OPTIONAL, MANAGED_PROPERTIES, MANAGED_SCOPE, MANAGED_VERSION
Constructor and Description |
---|
DefaultDependencyNode(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.
|
DefaultDependencyNode(DependencyNode node)
Creates a mostly shallow clone of the specified node.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(DependencyVisitor visitor)
Traverses this node and potentially its children using the specified visitor.
|
Collection<? extends Artifact> |
getAliases()
Gets the known aliases for this dependency's artifact.
|
Artifact |
getArtifact()
Gets the artifact associated with this node.
|
List<DependencyNode> |
getChildren()
Gets the child nodes of this node.
|
Map<Object,Object> |
getData()
Gets the custom data associated with this dependency node.
|
Dependency |
getDependency()
Gets the dependency associated with this node.
|
int |
getManagedBits()
Gets a bit field indicating which attributes of this node were subject to dependency management.
|
List<? extends Artifact> |
getRelocations()
Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.
|
List<RemoteRepository> |
getRepositories()
Gets the remote repositories from which this node's artifact shall be resolved.
|
String |
getRequestContext()
Gets the request context in which this dependency node was created.
|
Version |
getVersion()
Gets the version that was selected for the dependency's target artifact.
|
VersionConstraint |
getVersionConstraint()
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 |
setData(Map<Object,Object> data)
Sets the custom data associated with this dependency node.
|
void |
setData(Object key,
Object value)
Associates the specified dependency node data with the given key.
|
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 |
setScope(String scope)
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.
|
String |
toString() |
public DefaultDependencyNode(Dependency dependency)
dependency
- The dependency associated with this node, may be null
for a root node.public DefaultDependencyNode(Artifact artifact)
getDependency()
will return null
. Put differently, the specified artifact will not be subject to
dependency collection/resolution.artifact
- The artifact to use as label for this node, may be null
.public DefaultDependencyNode(DependencyNode node)
node
- The node to copy, must not be null
.public List<DependencyNode> getChildren()
DependencyNode
getChildren
in interface DependencyNode
null
.public void setChildren(List<DependencyNode> children)
DependencyNode
setChildren
in interface DependencyNode
children
- The child nodes, may be null
public Dependency getDependency()
DependencyNode
null
when invoked on the graph's root node. The root
node of such graphs may however still have a label as returned by DependencyNode.getArtifact()
.getDependency
in interface DependencyNode
null
if none.public Artifact getArtifact()
DependencyNode
getDependency().getArtifact()
. Otherwise the artifact merely provides a label for this node in which case
the artifact must not be subjected to dependency collection/resolution.getArtifact
in interface DependencyNode
null
if none.public void setArtifact(Artifact artifact)
DependencyNode
DependencyNode.getDependency()
is not null.setArtifact
in interface DependencyNode
artifact
- The artifact satisfying the dependency, must not be null
.public List<? extends Artifact> getRelocations()
DependencyNode
getRelocations
in interface DependencyNode
null
.public void setRelocations(List<? extends Artifact> relocations)
relocations
- The sequence of relocations, may be null
.public Collection<? extends Artifact> getAliases()
DependencyNode
getAliases
in interface DependencyNode
null
.public void setAliases(Collection<? extends Artifact> aliases)
aliases
- The known aliases, may be null
.public VersionConstraint getVersionConstraint()
DependencyNode
getVersionConstraint
in interface DependencyNode
null
.public void setVersionConstraint(VersionConstraint versionConstraint)
versionConstraint
- The version constraint for this node, may be null
.public Version getVersion()
DependencyNode
getVersion
in interface DependencyNode
null
.public void setVersion(Version version)
version
- The parsed version, may be null
.public void setScope(String scope)
DependencyNode
DependencyNode.getDependency()
is not null.setScope
in interface DependencyNode
scope
- The scope, may be null
.public void setOptional(Boolean optional)
DependencyNode
DependencyNode.getDependency()
is not null.setOptional
in interface DependencyNode
optional
- The optional flag, may be null
.public int getManagedBits()
DependencyNode
getManagedBits
in interface DependencyNode
DependencyNode.MANAGED_VERSION
, DependencyNode.MANAGED_SCOPE
,
DependencyNode.MANAGED_OPTIONAL
, DependencyNode.MANAGED_PROPERTIES
and DependencyNode.MANAGED_EXCLUSIONS
if the
corresponding attribute was set via dependency management.public void setManagedBits(int managedBits)
managedBits
- The bit field indicating the managed attributes or 0
if dependency management wasn't
applied.public List<RemoteRepository> getRepositories()
DependencyNode
getRepositories
in interface DependencyNode
null
.public void setRepositories(List<RemoteRepository> repositories)
repositories
- The remote repositories to use for artifact resolution, may be null
.public String getRequestContext()
DependencyNode
getRequestContext
in interface DependencyNode
null
.public void setRequestContext(String context)
DependencyNode
setRequestContext
in interface DependencyNode
context
- The context, may be null
.public Map<Object,Object> getData()
DependencyNode
DependencyNode.setData(Object, Object)
needs to be used to update the custom data.getData
in interface DependencyNode
null
.public void setData(Map<Object,Object> data)
DependencyNode
setData
in interface DependencyNode
data
- The new custom data, may be null
.public void setData(Object key, Object value)
DependencyNode
DependencyNode.getData()
is being iterated.setData
in interface DependencyNode
key
- The key under which to store the data, must not be null
.value
- The data to associate with the key, may be null
to remove the mapping.public boolean accept(DependencyVisitor visitor)
DependencyNode
accept
in interface DependencyNode
visitor
- The visitor to call back, must not be null
.true
to visit siblings nodes of this node as well, false
to skip siblings.Copyright © 2010–2019 The Apache Software Foundation. All rights reserved.