Class GenericVersionConstraint

java.lang.Object
org.eclipse.aether.util.version.GenericVersionConstraint
All Implemented Interfaces:
VersionConstraint

final class GenericVersionConstraint extends Object implements VersionConstraint
A constraint on versions for a dependency.
  • Field Details

  • Constructor Details

    • GenericVersionConstraint

      GenericVersionConstraint(VersionRange range)
      Creates a version constraint from the specified version range.
      Parameters:
      range - The version range, must not be null.
    • GenericVersionConstraint

      GenericVersionConstraint(Version version)
      Creates a version constraint from the specified version.
      Parameters:
      version - The version, must not be null.
  • Method Details

    • getRange

      public VersionRange getRange()
      Description copied from interface: VersionConstraint
      Gets the version range of this constraint.
      Specified by:
      getRange in interface VersionConstraint
      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 interface VersionConstraint
      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 interface VersionConstraint
      Parameters:
      version - The version to test, must not be null.
      Returns:
      true if the specified version satisfies this constraint, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • hash

      private static int hash(Object obj)