Class DefaultDependencyNode
- java.lang.Object
-
- org.apache.maven.shared.dependency.graph.internal.DefaultDependencyNode
-
- All Implemented Interfaces:
DependencyNode
public class DefaultDependencyNode extends java.lang.Object implements DependencyNode
Default implementation of a DependencyNode.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DefaultDependencyNode.ItemAppender
Utility class to concatenate a number of parameters with separator tokens.
-
Field Summary
Fields Modifier and Type Field Description private org.apache.maven.artifact.Artifact
artifact
private java.util.List<DependencyNode>
children
private java.lang.Boolean
optional
private DependencyNode
parent
private java.lang.String
premanagedScope
private java.lang.String
premanagedVersion
private java.lang.String
versionConstraint
-
Constructor Summary
Constructors Constructor Description DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, java.lang.String premanagedVersion, java.lang.String premanagedScope, java.lang.String versionConstraint)
Constructs the DefaultDependencyNode.DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, java.lang.String premanagedVersion, java.lang.String premanagedScope, java.lang.String versionConstraint, java.lang.Boolean optional)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(DependencyNodeVisitor visitor)
Applies the specified dependency node visitor to this dependency node and its children.org.apache.maven.artifact.Artifact
getArtifact()
java.util.List<DependencyNode>
getChildren()
java.lang.Boolean
getOptional()
DependencyNode
getParent()
Gets the parent dependency node of this dependency node.java.lang.String
getPremanagedScope()
Gets the scope for the dependency before dependency management was applied (if any).java.lang.String
getPremanagedVersion()
Gets the version or version range for the dependency before dependency management was applied (if any).java.lang.String
getVersionConstraint()
A constraint on versions for a dependency.void
setChildren(java.util.List<DependencyNode> children)
java.lang.String
toNodeString()
Returns a string representation of this dependency node.
-
-
-
Field Detail
-
artifact
private final org.apache.maven.artifact.Artifact artifact
-
parent
private final DependencyNode parent
-
premanagedVersion
private final java.lang.String premanagedVersion
-
premanagedScope
private final java.lang.String premanagedScope
-
versionConstraint
private final java.lang.String versionConstraint
-
children
private java.util.List<DependencyNode> children
-
optional
private java.lang.Boolean optional
-
-
Constructor Detail
-
DefaultDependencyNode
public DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, java.lang.String premanagedVersion, java.lang.String premanagedScope, java.lang.String versionConstraint)
Constructs the DefaultDependencyNode.- Parameters:
parent
- Parent node, may benull
.artifact
- Artifact associated with this dependency.premanagedVersion
- the premanaged version, may benull
.premanagedScope
- the premanaged scope, may benull
.versionConstraint
- the version constraint, may benull.
-
DefaultDependencyNode
public DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, java.lang.String premanagedVersion, java.lang.String premanagedScope, java.lang.String versionConstraint, java.lang.Boolean optional)
-
-
Method Detail
-
accept
public boolean accept(DependencyNodeVisitor visitor)
Applies the specified dependency node visitor to this dependency node and its children.- Specified by:
accept
in interfaceDependencyNode
- Parameters:
visitor
- the dependency node visitor to use- Returns:
- the visitor result of ending the visit to this node
- Since:
- 1.1
-
getArtifact
public org.apache.maven.artifact.Artifact getArtifact()
- Specified by:
getArtifact
in interfaceDependencyNode
- Returns:
- Artifact for this DependencyNode.
-
setChildren
public void setChildren(java.util.List<DependencyNode> children)
- Parameters:
children
- List of DependencyNode to set as child nodes.
-
getChildren
public java.util.List<DependencyNode> getChildren()
- Specified by:
getChildren
in interfaceDependencyNode
- Returns:
- List of child nodes for this DependencyNode.
-
getParent
public DependencyNode getParent()
Description copied from interface:DependencyNode
Gets the parent dependency node of this dependency node.- Specified by:
getParent
in interfaceDependencyNode
- Returns:
- Parent of this DependencyNode.
-
getPremanagedVersion
public java.lang.String getPremanagedVersion()
Description copied from interface:DependencyNode
Gets the version or version range for the dependency before dependency management was applied (if any).- Specified by:
getPremanagedVersion
in interfaceDependencyNode
- Returns:
- The dependency version before dependency management or
null
if the version was not managed.
-
getPremanagedScope
public java.lang.String getPremanagedScope()
Description copied from interface:DependencyNode
Gets the scope for the dependency before dependency management was applied (if any).- Specified by:
getPremanagedScope
in interfaceDependencyNode
- Returns:
- The dependency scope before dependency management or
null
if the scope was not managed.
-
getVersionConstraint
public java.lang.String getVersionConstraint()
Description copied from interface:DependencyNode
A constraint on versions for a dependency. A constraint can either consist of one or more version ranges or a single version.- Specified by:
getVersionConstraint
in interfaceDependencyNode
- Returns:
- The constraint on the dependency.
-
getOptional
public java.lang.Boolean getOptional()
- Specified by:
getOptional
in interfaceDependencyNode
- Returns:
- true for an optional dependency.
-
toNodeString
public java.lang.String toNodeString()
Description copied from interface:DependencyNode
Returns a string representation of this dependency node.- Specified by:
toNodeString
in interfaceDependencyNode
- Returns:
- Stringified representation of this DependencyNode.
-
-