Package org.eclipse.aether.util.version
Class GenericVersionConstraint
- java.lang.Object
-
- org.eclipse.aether.util.version.GenericVersionConstraint
-
- All Implemented Interfaces:
VersionConstraint
final class GenericVersionConstraint extends java.lang.Object implements VersionConstraint
A constraint on versions for a dependency.
-
-
Field Summary
Fields Modifier and Type Field Description private VersionRange
range
private Version
version
-
Constructor Summary
Constructors Constructor Description GenericVersionConstraint(Version version)
Creates a version constraint from the specified version.GenericVersionConstraint(VersionRange range)
Creates a version constraint from the specified version range.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsVersion(Version version)
Determines whether the specified version satisfies this constraint.boolean
equals(java.lang.Object obj)
VersionRange
getRange()
Gets the version range of this constraint.Version
getVersion()
Gets the version recommended by this constraint.private static int
hash(java.lang.Object obj)
int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
range
private final VersionRange range
-
version
private final Version version
-
-
Constructor Detail
-
GenericVersionConstraint
GenericVersionConstraint(VersionRange range)
Creates a version constraint from the specified version range.- Parameters:
range
- The version range, must not benull
.
-
GenericVersionConstraint
GenericVersionConstraint(Version version)
Creates a version constraint from the specified version.- Parameters:
version
- The version, must not benull
.
-
-
Method Detail
-
getRange
public VersionRange getRange()
Description copied from interface:VersionConstraint
Gets the version range of this constraint.- Specified by:
getRange
in interfaceVersionConstraint
- Returns:
- The version range or
null
if none.
-
getVersion
public Version getVersion()
Description copied from interface:VersionConstraint
Gets the version recommended by this constraint.- Specified by:
getVersion
in interfaceVersionConstraint
- Returns:
- The recommended version or
null
if none.
-
containsVersion
public boolean containsVersion(Version version)
Description copied from interface:VersionConstraint
Determines whether the specified version satisfies this constraint. In more detail, a version satisfies this constraint if it matches its version range or if this constraint has no version range and the specified version equals the version recommended by the constraint.- Specified by:
containsVersion
in interfaceVersionConstraint
- Parameters:
version
- The version to test, must not benull
.- Returns:
true
if the specified version satisfies this constraint,false
otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
hash
private static int hash(java.lang.Object obj)
-
-