|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sonatype.aether.util.version.GenericVersionScheme
public class GenericVersionScheme
A version scheme using a generic version syntax and common sense sorting. This scheme accepts versions of any form, interpreting a version as a sequence of numeric and alphabetic components. The characters '-' and '.' as well as the mere transitions from digit to letter and vice versa delimit the version components. Delimiters are treated as equivalent. Numeric components are compared mathematically, alphabetic components are compared lexicographically and case-insensitively. However, the following qualifier strings are recognized and treated specially: "alpha" < "beta" < "milestone" < "cr" = "rc" < "snapshot" < "final" = "ga" < "sp". All of those well-known qualifiers are considered smaller/older than other strings. An empty component/string is equivalent to 0. Numbers and strings are considered incomparable against each other. Where version components of different kind would collide, comparison will instead assume that the previous components are padded with 0 or "ga", respectively, until the kind mismatch is resolved, i.e. 1-alpha = 1.0.0-alpha < 1.0.1-ga = 1.0.1.
Constructor Summary | |
---|---|
GenericVersionScheme()
Creates a new instance of the version scheme for parsing versions. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
int |
hashCode()
|
Version |
parseVersion(String version)
Parses the specified version string, for example "1.0". |
VersionConstraint |
parseVersionConstraint(String constraint)
Parses the specified version constraint specification, for example "1.0" or "[1.0,2.0),(2.0,)". |
VersionRange |
parseVersionRange(String range)
Parses the specified version range specification, for example "[1.0,2.0)". |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericVersionScheme()
Method Detail |
---|
public Version parseVersion(String version) throws InvalidVersionSpecificationException
VersionScheme
parseVersion
in interface VersionScheme
version
- The version string to parse, must not be null
.
null
.
InvalidVersionSpecificationException
- If the string violates the syntax rules of this scheme.public VersionRange parseVersionRange(String range) throws InvalidVersionSpecificationException
VersionScheme
parseVersionRange
in interface VersionScheme
range
- The range specification to parse, must not be null
.
null
.
InvalidVersionSpecificationException
- If the range specification violates the syntax rules of this scheme.public VersionConstraint parseVersionConstraint(String constraint) throws InvalidVersionSpecificationException
VersionScheme
parseVersionConstraint
in interface VersionScheme
constraint
- The constraint specification to parse, must not be null
.
null
.
InvalidVersionSpecificationException
- If the constraint specification violates the syntax rules of this
scheme.public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |