public class DependencyNode extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INCLUDED
State that represents an included dependency node.
|
static int |
OMITTED_FOR_CONFLICT
State that represents a dependency node that has been omitted for conflicting with another dependency node.
|
static int |
OMITTED_FOR_CYCLE
State that represents a dependency node that has been omitted for introducing a cycle into the dependency tree.
|
static int |
OMITTED_FOR_DUPLICATE
State that represents a dependency node that has been omitted for duplicating another dependency node.
|
Constructor and Description |
---|
DependencyNode(Artifact artifact)
Creates a new dependency node for the specified artifact with an included state.
|
DependencyNode(Artifact artifact,
int state)
Creates a new dependency node for the specified artifact with the specified state.
|
DependencyNode(Artifact artifact,
int state,
Artifact relatedArtifact)
Creates a new dependency node for the specified artifact with the specified state and related artifact.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(DependencyNodeVisitor visitor)
Applies the specified dependency node visitor to this dependency node and its children.
|
void |
addChild(DependencyNode child)
Adds the specified dependency node to this dependency node's children.
|
boolean |
equals(Object object) |
Artifact |
getArtifact()
Gets the artifact attached to this dependency node.
|
List<org.apache.maven.artifact.versioning.ArtifactVersion> |
getAvailableVersions()
If the version was selected from a range this method will return the available versions when making the decision.
|
List<DependencyNode> |
getChildren()
Gets the list of child dependency nodes of this dependency node.
|
int |
getDepth()
Deprecated.
As of 1.1, depth is computed by node hierarchy. With the introduction of node visitors and filters
this method can give misleading results. For example, consider serializing a tree with a filter using
a visitor: this method would return the unfiltered depth of a node, whereas the correct depth would
be calculated by the visitor.
|
String |
getFailedUpdateScope()
Gets the scope that this node's artifact was attempted to be updated to due to conflicts.
|
String |
getOriginalScope()
Gets the scope of this node's artifact before it was updated due to conflicts.
|
DependencyNode |
getParent()
Gets the parent dependency node of this dependency node.
|
String |
getPremanagedScope()
Gets the scope of this node's artifact before it was updated by dependency management.
|
String |
getPremanagedVersion()
Gets the version of this node's artifact before it was updated by dependency management.
|
Artifact |
getRelatedArtifact()
Gets the artifact related to the state of this dependency node.
|
int |
getState()
Gets the state of this dependency node.
|
org.apache.maven.artifact.versioning.VersionRange |
getVersionSelectedFromRange()
If the version was selected from a range this method will return the range.
|
boolean |
hasChildren() |
int |
hashCode() |
Iterator<DependencyNode> |
inverseIterator()
Gets an iterator that returns this dependency node and it's children in postorder traversal.
|
Iterator<DependencyNode> |
iterator()
Gets an iterator that returns this dependency node and it's children in preorder traversal.
|
void |
omitForConflict(Artifact relatedArtifact)
Changes the state of this dependency node to be omitted for conflict or duplication, depending on the specified
related artifact.
|
void |
omitForCycle()
Changes the state of this dependency node to be omitted for a cycle in the dependency tree.
|
Iterator<DependencyNode> |
preorderIterator()
Gets an iterator that returns this dependency node and it's children in preorder traversal.
|
void |
removeChild(DependencyNode child)
Removes the specified dependency node from this dependency node's children.
|
void |
setAvailableVersions(List<org.apache.maven.artifact.versioning.ArtifactVersion> availableVersions) |
void |
setFailedUpdateScope(String failedUpdateScope)
Sets the scope that this node's artifact was attempted to be updated to due to conflicts.
|
void |
setOriginalScope(String originalScope)
Sets the scope of this node's artifact before it was updated due to conflicts.
|
void |
setPremanagedScope(String premanagedScope)
Sets the scope of this node's artifact before it was updated by dependency management.
|
void |
setPremanagedVersion(String premanagedVersion)
Sets the version of this node's artifact before it was updated by dependency management.
|
void |
setVersionSelectedFromRange(org.apache.maven.artifact.versioning.VersionRange versionSelectedFromRange) |
String |
toNodeString()
Returns a string representation of this dependency node.
|
String |
toString()
Returns a string representation of this dependency node and its children.
|
String |
toString(int indentDepth)
Deprecated.
As of 1.1, replaced by
toString() |
public static final int INCLUDED
public static final int OMITTED_FOR_DUPLICATE
public static final int OMITTED_FOR_CONFLICT
public static final int OMITTED_FOR_CYCLE
public DependencyNode(Artifact artifact)
artifact
- the artifact attached to the new dependency nodeIllegalArgumentException
- if the parameter constraints were violatedpublic DependencyNode(Artifact artifact, int state)
artifact
- the artifact attached to the new dependency nodestate
- the state of the new dependency node. This can be either INCLUDED
or
OMITTED_FOR_CYCLE
.IllegalArgumentException
- if the parameter constraints were violatedpublic DependencyNode(Artifact artifact, int state, Artifact relatedArtifact)
artifact
- the artifact attached to the new dependency nodestate
- the state of the new dependency node. This can be either INCLUDED
,
OMITTED_FOR_DUPLICATE
, OMITTED_FOR_CONFLICT
or
OMITTED_FOR_CYCLE
.relatedArtifact
- the artifact related to the state of this dependency node. For dependency nodes with a
state of OMITTED_FOR_DUPLICATE
or OMITTED_FOR_CONFLICT
, this represents the
artifact that was conflicted with. For dependency nodes of other states, this should always be
null
.IllegalArgumentException
- if the parameter constraints were violatedpublic boolean accept(DependencyNodeVisitor visitor)
visitor
- the dependency node visitor to usepublic void addChild(DependencyNode child)
child
- the child dependency node to addpublic void removeChild(DependencyNode child)
child
- the child dependency node to removepublic DependencyNode getParent()
public Artifact getArtifact()
public int getDepth()
public List<DependencyNode> getChildren()
public boolean hasChildren()
public int getState()
INCLUDED
, OMITTED_FOR_DUPLICATE
,
OMITTED_FOR_CONFLICT
or OMITTED_FOR_CYCLE
.public Artifact getRelatedArtifact()
OMITTED_FOR_CONFLICT
, this represents the artifact that was conflicted with. For dependency nodes of
other states, this is always null
.public String getOriginalScope()
null
if the artifact scope has not been updatedpublic void setOriginalScope(String originalScope)
originalScope
- the original scope, or null
if the artifact scope has not been updatedpublic String getFailedUpdateScope()
null
if the artifact scope has not failed being updatedpublic void setFailedUpdateScope(String failedUpdateScope)
failedUpdateScope
- the failed update scope, or null
if the artifact scope has not failed being
updatedpublic String getPremanagedVersion()
null
if the artifact version has not been managedpublic void setPremanagedVersion(String premanagedVersion)
premanagedVersion
- the premanaged version, or null
if the artifact version has not been
managedpublic String getPremanagedScope()
null
if the artifact scope has not been managedpublic void setPremanagedScope(String premanagedScope)
premanagedScope
- the premanaged scope, or null
if the artifact scope has not been managedpublic org.apache.maven.artifact.versioning.VersionRange getVersionSelectedFromRange()
null
if the artifact had a explicit
version.public void setVersionSelectedFromRange(org.apache.maven.artifact.versioning.VersionRange versionSelectedFromRange)
public List<org.apache.maven.artifact.versioning.ArtifactVersion> getAvailableVersions()
public void setAvailableVersions(List<org.apache.maven.artifact.versioning.ArtifactVersion> availableVersions)
public void omitForConflict(Artifact relatedArtifact)
If the related artifact has a version equal to this dependency node's artifact, then this dependency node's state
is changed to OMITTED_FOR_DUPLICATE
, otherwise it is changed to OMITTED_FOR_CONFLICT
.
Omitting this dependency node also removes all of its children.
relatedArtifact
- the artifact that this dependency node conflicted withIllegalStateException
- if this dependency node's state is not INCLUDED
IllegalArgumentException
- if the related artifact was null
or had a different dependency
conflict id to this dependency node's artifactOMITTED_FOR_DUPLICATE
,
OMITTED_FOR_CONFLICT
public void omitForCycle()
Omitting this node sets its state to OMITTED_FOR_CYCLE
and removes all of its children.
IllegalStateException
- if this dependency node's state is not INCLUDED
OMITTED_FOR_CYCLE
public Iterator<DependencyNode> iterator()
preorderIterator()
public Iterator<DependencyNode> preorderIterator()
DependencyTreePreorderIterator
public Iterator<DependencyNode> inverseIterator()
DependencyTreeInverseIterator
public String toNodeString()
toString()
public String toString(int indentDepth)
toString()
As of 1.1, this method ignores the indentation depth and simply delegates to toString()
.
indentDepth
- the indentation depthpublic String toString()
toString
in class Object
toNodeString()
,
Object.toString()
Copyright © 2002–2014 The Apache Software Foundation. All rights reserved.