|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.maven.shared.dependency.tree.DependencyNode
public class DependencyNode
Represents an artifact node within a Maven project's dependency tree.
Field Summary | |
---|---|
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 Summary | |
---|---|
DependencyNode(org.apache.maven.artifact.Artifact artifact)
Creates a new dependency node for the specified artifact with an included state. |
|
DependencyNode(org.apache.maven.artifact.Artifact artifact,
int state)
Creates a new dependency node for the specified artifact with the specified state. |
|
DependencyNode(org.apache.maven.artifact.Artifact artifact,
int state,
org.apache.maven.artifact.Artifact relatedArtifact)
Creates a new dependency node for the specified artifact with the specified state and related artifact. |
Method Summary | |
---|---|
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(java.lang.Object object)
|
org.apache.maven.artifact.Artifact |
getArtifact()
Gets the artifact attached to this dependency node. |
java.util.List |
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 serialising 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. |
java.lang.String |
getFailedUpdateScope()
Gets the scope that this node's artifact was attempted to be updated to due to conflicts. |
java.lang.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. |
java.lang.String |
getPremanagedScope()
Gets the scope of this node's artifact before it was updated by dependency management. |
java.lang.String |
getPremanagedVersion()
Gets the version of this node's artifact before it was updated by dependency management. |
org.apache.maven.artifact.Artifact |
getRelatedArtifact()
Gets the artifact related to the state of this dependency node. |
int |
getState()
Gets the state of this dependency node. |
boolean |
hasChildren()
|
int |
hashCode()
|
java.util.Iterator |
inverseIterator()
Gets an iterator that returns this dependency node and it's children in postorder traversal. |
java.util.Iterator |
iterator()
Gets an iterator that returns this dependency node and it's children in preorder traversal. |
void |
omitForConflict(org.apache.maven.artifact.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. |
java.util.Iterator |
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 |
setFailedUpdateScope(java.lang.String failedUpdateScope)
Sets the scope that this node's artifact was attempted to be updated to due to conflicts. |
void |
setOriginalScope(java.lang.String originalScope)
Sets the scope of this node's artifact before it was updated due to conflicts. |
void |
setPremanagedScope(java.lang.String premanagedScope)
Sets the scope of this node's artifact before it was updated by dependency management. |
void |
setPremanagedVersion(java.lang.String premanagedVersion)
Sets the version of this node's artifact before it was updated by dependency management. |
java.lang.String |
toNodeString()
Returns a string representation of this dependency node. |
java.lang.String |
toString()
Returns a string representation of this dependency node and its children. |
java.lang.String |
toString(int indentDepth)
Deprecated. As of 1.1, replaced by toString() |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public DependencyNode(org.apache.maven.artifact.Artifact artifact)
artifact
- the artifact attached to the new dependency node
java.lang.IllegalArgumentException
- if the parameter constraints were violatedpublic DependencyNode(org.apache.maven.artifact.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
.
java.lang.IllegalArgumentException
- if the parameter constraints were violatedpublic DependencyNode(org.apache.maven.artifact.Artifact artifact, int state, org.apache.maven.artifact.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
.
java.lang.IllegalArgumentException
- if the parameter constraints were violatedMethod Detail |
---|
public boolean accept(DependencyNodeVisitor visitor)
visitor
- the dependency node visitor to use
public 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 org.apache.maven.artifact.Artifact getArtifact()
public int getDepth()
public java.util.List getChildren()
public boolean hasChildren()
public int getState()
INCLUDED
, OMITTED_FOR_DUPLICATE
,
OMITTED_FOR_CONFLICT
or OMITTED_FOR_CYCLE
.public org.apache.maven.artifact.Artifact getRelatedArtifact()
OMITTED_FOR_CONFLICT
, this represents the artifact that was conflicted with. For dependency nodes
of other states, this is always null
.
public java.lang.String getOriginalScope()
null
if the artifact scope has not been updatedpublic void setOriginalScope(java.lang.String originalScope)
originalScope
- the original scope, or null
if the artifact scope has not been updatedpublic java.lang.String getFailedUpdateScope()
null
if the artifact scope has not failed being updatedpublic void setFailedUpdateScope(java.lang.String failedUpdateScope)
failedUpdateScope
- the failed update scope, or null
if the artifact scope has not failed being updatedpublic java.lang.String getPremanagedVersion()
null
if the artifact version has not been managedpublic void setPremanagedVersion(java.lang.String premanagedVersion)
premanagedVersion
- the premanaged version, or null
if the artifact version has not been managedpublic java.lang.String getPremanagedScope()
null
if the artifact scope has not been managedpublic void setPremanagedScope(java.lang.String premanagedScope)
premanagedScope
- the premanaged scope, or null
if the artifact scope has not been managedpublic void omitForConflict(org.apache.maven.artifact.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 with
java.lang.IllegalStateException
- if this dependency node's state is not INCLUDED
java.lang.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.
java.lang.IllegalStateException
- if this dependency node's state is not INCLUDED
OMITTED_FOR_CYCLE
public java.util.Iterator iterator()
preorderIterator()
public java.util.Iterator preorderIterator()
DependencyTreePreorderIterator
public java.util.Iterator inverseIterator()
DependencyTreeInverseIterator
public java.lang.String toNodeString()
toString()
public java.lang.String toString(int indentDepth)
toString()
As of 1.1, this method ignores the indentation depth and simply delegates to toString()
.
indentDepth
- the indentation depth
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
toNodeString()
,
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |