public final class Dependency
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Dependency.Exclusions |
Modifier and Type | Field and Description |
---|---|
private Artifact |
artifact |
private java.util.Set<Exclusion> |
exclusions |
private java.lang.Boolean |
optional |
private java.lang.String |
scope |
Modifier | Constructor and Description |
---|---|
|
Dependency(Artifact artifact,
java.lang.String scope)
Creates a mandatory dependency on the specified artifact with the given scope.
|
|
Dependency(Artifact artifact,
java.lang.String scope,
java.lang.Boolean optional)
Creates a dependency on the specified artifact with the given scope.
|
|
Dependency(Artifact artifact,
java.lang.String scope,
java.lang.Boolean optional,
java.util.Collection<Exclusion> exclusions)
Creates a dependency on the specified artifact with the given scope and exclusions.
|
private |
Dependency(Artifact artifact,
java.lang.String scope,
java.util.Set<Exclusion> exclusions,
java.lang.Boolean optional) |
Modifier and Type | Method and Description |
---|---|
private static <T> boolean |
eq(T o1,
T o2) |
boolean |
equals(java.lang.Object obj) |
Artifact |
getArtifact()
Gets the artifact being depended on.
|
java.util.Collection<Exclusion> |
getExclusions()
Gets the exclusions for this dependency.
|
java.lang.Boolean |
getOptional()
Gets the optional flag for the dependency.
|
java.lang.String |
getScope()
Gets the scope of the dependency.
|
private boolean |
hasEquivalentExclusions(java.util.Collection<Exclusion> exclusions) |
int |
hashCode() |
boolean |
isOptional()
Indicates whether this dependency is optional or not.
|
Dependency |
setArtifact(Artifact artifact)
Sets the artifact being depended on.
|
Dependency |
setExclusions(java.util.Collection<Exclusion> exclusions)
Sets the exclusions for the dependency.
|
Dependency |
setOptional(java.lang.Boolean optional)
Sets the optional flag for the dependency.
|
Dependency |
setScope(java.lang.String scope)
Sets the scope of the dependency, e.g.
|
java.lang.String |
toString() |
private final Artifact artifact
private final java.lang.String scope
private final java.lang.Boolean optional
private final java.util.Set<Exclusion> exclusions
public Dependency(Artifact artifact, java.lang.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, java.lang.String scope, java.lang.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, java.lang.String scope, java.lang.Boolean optional, java.util.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 java.lang.String getScope()
null
.public Dependency setScope(java.lang.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 java.lang.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(java.lang.Boolean optional)
optional
- true
if the dependency is optional, false
if the dependency is mandatory, may be
null
if unspecified.null
.public java.util.Collection<Exclusion> getExclusions()
null
.public Dependency setExclusions(java.util.Collection<Exclusion> exclusions)
exclusions
- The exclusions, may be null
.null
.private boolean hasEquivalentExclusions(java.util.Collection<Exclusion> exclusions)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
private static <T> boolean eq(T o1, T o2)
public int hashCode()
hashCode
in class java.lang.Object