Class DefaultDependencyNode
- java.lang.Object
-
- org.apache.maven.shared.dependency.graph.internal.DefaultDependencyNode
-
- All Implemented Interfaces:
DependencyNode
public class DefaultDependencyNode extends Object implements DependencyNode
Default implementation of a DependencyNode.
-
-
Constructor Summary
Constructors Constructor Description DefaultDependencyNode(org.apache.maven.artifact.Artifact artifact)DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, String premanagedVersion, String premanagedScope, String versionConstraint)Constructs the DefaultDependencyNode.DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, String premanagedVersion, String premanagedScope, String versionConstraint, Boolean optional, List<org.apache.maven.model.Exclusion> exclusions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(DependencyNodeVisitor visitor)Applies the specified dependency node visitor to this dependency node and its children.org.apache.maven.artifact.ArtifactgetArtifact()List<DependencyNode>getChildren()List<org.apache.maven.model.Exclusion>getExclusions()BooleangetOptional()DependencyNodegetParent()Gets the parent dependency node of this dependency node.StringgetPremanagedScope()Gets the scope for the dependency before dependency management was applied (if any).StringgetPremanagedVersion()Gets the version or version range for the dependency before dependency management was applied (if any).StringgetVersionConstraint()A constraint on versions for a dependency.voidsetChildren(List<DependencyNode> children)StringtoNodeString()Returns a string representation of this dependency node.
-
-
-
Constructor Detail
-
DefaultDependencyNode
public DefaultDependencyNode(DependencyNode parent, org.apache.maven.artifact.Artifact artifact, String premanagedVersion, String premanagedScope, 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, String premanagedVersion, String premanagedScope, String versionConstraint, Boolean optional, List<org.apache.maven.model.Exclusion> exclusions)
-
DefaultDependencyNode
public DefaultDependencyNode(org.apache.maven.artifact.Artifact artifact)
-
-
Method Detail
-
accept
public boolean accept(DependencyNodeVisitor visitor)
Applies the specified dependency node visitor to this dependency node and its children.- Specified by:
acceptin 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:
getArtifactin interfaceDependencyNode- Returns:
- Artifact for this DependencyNode.
-
setChildren
public void setChildren(List<DependencyNode> children)
- Parameters:
children- List of DependencyNode to set as child nodes.
-
getChildren
public List<DependencyNode> getChildren()
- Specified by:
getChildrenin interfaceDependencyNode- Returns:
- List of child nodes for this DependencyNode.
-
getParent
public DependencyNode getParent()
Description copied from interface:DependencyNodeGets the parent dependency node of this dependency node.- Specified by:
getParentin interfaceDependencyNode- Returns:
- Parent of this DependencyNode.
-
getPremanagedVersion
public String getPremanagedVersion()
Description copied from interface:DependencyNodeGets the version or version range for the dependency before dependency management was applied (if any).- Specified by:
getPremanagedVersionin interfaceDependencyNode- Returns:
- The dependency version before dependency management or
nullif the version was not managed.
-
getPremanagedScope
public String getPremanagedScope()
Description copied from interface:DependencyNodeGets the scope for the dependency before dependency management was applied (if any).- Specified by:
getPremanagedScopein interfaceDependencyNode- Returns:
- The dependency scope before dependency management or
nullif the scope was not managed.
-
getVersionConstraint
public String getVersionConstraint()
Description copied from interface:DependencyNodeA constraint on versions for a dependency. A constraint can either consist of one or more version ranges or a single version.- Specified by:
getVersionConstraintin interfaceDependencyNode- Returns:
- The constraint on the dependency.
-
getOptional
public Boolean getOptional()
- Specified by:
getOptionalin interfaceDependencyNode- Returns:
- true for an optional dependency.
-
getExclusions
public List<org.apache.maven.model.Exclusion> getExclusions()
- Specified by:
getExclusionsin interfaceDependencyNode- Returns:
- the exclusions of the dependency
-
toNodeString
public String toNodeString()
Description copied from interface:DependencyNodeReturns a string representation of this dependency node.- Specified by:
toNodeStringin interfaceDependencyNode- Returns:
- Stringified representation of this DependencyNode.
-
-