public final class Dependency extends Object
Constructor and Description |
---|
Dependency(Artifact artifact,
String scope)
Creates a mandatory dependency on the specified artifact with the given scope.
|
Dependency(Artifact artifact,
String scope,
Boolean optional)
Creates a dependency on the specified artifact with the given scope.
|
Dependency(Artifact artifact,
String scope,
Boolean optional,
Collection<Exclusion> exclusions)
Creates a dependency on the specified artifact with the given scope and exclusions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Artifact |
getArtifact()
Gets the artifact being depended on.
|
Collection<Exclusion> |
getExclusions()
Gets the exclusions for this dependency.
|
Boolean |
getOptional()
Gets the optional flag for the dependency.
|
String |
getScope()
Gets the scope of the dependency.
|
int |
hashCode() |
boolean |
isOptional()
Indicates whether this dependency is optional or not.
|
Dependency |
setArtifact(Artifact artifact)
Sets the artifact being depended on.
|
Dependency |
setExclusions(Collection<Exclusion> exclusions)
Sets the exclusions for the dependency.
|
Dependency |
setOptional(Boolean optional)
Sets the optional flag for the dependency.
|
Dependency |
setScope(String scope)
Sets the scope of the dependency, e.g.
|
String |
toString() |
public Dependency(Artifact artifact, String scope)
artifact
- The artifact being depended on, must not be null
.scope
- The scope of the dependency, may be null
.public Dependency(Artifact artifact, String scope, Boolean optional)
artifact
- The artifact being depended on, must not be null
.scope
- The scope of the dependency, may be null
.optional
- A flag whether the dependency is optional or mandatory, may be null
.public Dependency(Artifact artifact, String scope, Boolean optional, Collection<Exclusion> exclusions)
artifact
- The artifact being depended on, must not be null
.scope
- The scope of the dependency, may be null
.optional
- A flag whether the dependency is optional or mandatory, may be null
.exclusions
- The exclusions that apply to transitive dependencies, may be null
if none.public Artifact getArtifact()
null
.public Dependency setArtifact(Artifact artifact)
artifact
- The artifact, must not be null
.null
.public String getScope()
null
.public Dependency setScope(String scope)
scope
- The scope of the dependency, may be null
.null
.public boolean isOptional()
true
if the dependency is (definitively) optional, false
otherwise.public Boolean getOptional()
isOptional()
to
determine the optional flag, this method is for advanced use cases where three-valued logic is required.null
if unspecified.public Dependency setOptional(Boolean optional)
optional
- true
if the dependency is optional, false
if the dependency is mandatory, may be
null
if unspecified.null
.public Collection<Exclusion> getExclusions()
null
.public Dependency setExclusions(Collection<Exclusion> exclusions)
exclusions
- The exclusions, may be null
.null
.Copyright © 2010–2021 The Apache Software Foundation. All rights reserved.