|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.module.VersionConstraint
public final class VersionConstraint
This class represents a version constraint in the module system. A version constraint is either a version, a version range, or combination of both.
For example,
Version:
1
1.7
1.7-b61
1.7.0
1.7.0-b61
1.7.0.0
1.7.0.1
1.7.1.3-b32-beta-1
1.7.1.3-b56_rc
General version range:
[1.2.3.4, 5.6.7.8) ~ 1.2.3.4 <= x < 5.6.7.8
(1.2.3.4, 5.6.7.8] ~ 1.2.3.4 < x <= 5.6.7.8
(1.2.3.4, 5.6.7.8) ~ 1.2.3.4 < x < 5.6.7.8
[1.2.3.4, 5.6.7.8] ~ 1.2.3.4 <= x <= 5.6.7.8
Open version range:
1+ ~ [1, infinity) ~ 1 <= x < infinity
1.2+ ~ [1.2, infinity) ~ 1.2 <= x < infinity
1.2.3+ ~ [1.2.3, infinity) ~ 1.2.3 <= x < infinity
1.2.3.4+ ~ [1.2.3.4, infinity) ~ 1.2.3.4 <= x < infinity
Family version range:
1.* ~ [1, 2) ~ 1 <= x < 2
1.2.* ~ [1.2, 1.3) ~ 1.2 <= x < 1.3
1.2.3.* ~ [1.2.3, 1.2.4) ~ 1.2.3 <= x < 1.2.4
Union of ranges:
[1.2.3.4, 2.0);2.*;3+ ~ 1.2.3.4 <= x < infinity
1.*;[2.0, 2.7.3) ~ 1.0.0 <= x < 2.7.3
The version constraint format is described by the following grammar:
version-constraint := simple-version-constraint (';' simple-version-constraint)*
simple-version-constraint := version | version-range
version-range := simple-version-range (';' simple-version-range)*
simple-version-range := general-version-range | open-version-range | family-version-range
general-version-range := ('[' | '(') simple-version ',' simple-version (')' | ']')
open-version-range := simple-version '+'
family-version-range := major '.' (minor '.' (micro '.')?)? '*'
version := simple-version ('-' qualifier)?
simple-version:= major ('.' minor ('.' micro ('.' update)?)?)?
major := digit+
minor := digit+
micro := digit+
update := digit+
qualifier := (alpha | digit | '-' | '_')+
where alpha is an alphabetic character, e.g. a-z, A-Z.
digit is a decimal digit, e.g. 0-9.
Applications can obtain VersionConstraint objects by calling the
valueOf() factory method.
Instances of this class are immutable and safe for concurrent use by multiple threads.
Version| Field Summary | |
|---|---|
static VersionConstraint |
DEFAULT
A VersionConstraint object that represents the default version
constraint that is "0.0.0.0+". |
| Method Summary | |
|---|---|
boolean |
contains(Version version)
Returns true if the specified Version is contained within any of
the ranges known to this VersionConstraint. |
boolean |
contains(VersionConstraint versionConstraint)
Returns true if the specified VersionConstraint is contained
within any of the ranges known to this VersionConstraint. |
boolean |
equals(Object obj)
Compare two VersionConstraint objects for equality. |
int |
hashCode()
Returns a hash code for this VersionConstraint. |
String |
toString()
Returns a String object representing this
VersionConstraint's value. |
static VersionConstraint |
valueOf(String versionConstraint)
Returns a VersionConstraint object holding the value of the
specified string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final VersionConstraint DEFAULT
VersionConstraint object that represents the default version
constraint that is "0.0.0.0+".
| Method Detail |
|---|
public boolean contains(Version version)
Version is contained within any of
the ranges known to this VersionConstraint.
version - the Version object.
public boolean contains(VersionConstraint versionConstraint)
VersionConstraint is contained
within any of the ranges known to this VersionConstraint.
versionConstraint - the VersionConstraint object.
public static VersionConstraint valueOf(String versionConstraint)
VersionConstraint object holding the value of the
specified string.
The string must be in the version constraint format and must not
contain any leading or trailing whitespace.
versionConstraint - the string to be parsed.
VersionConstraint parsed from the string.
IllegalArgumentException - if the string cannot be parsed.public boolean equals(Object obj)
VersionConstraint objects for equality. The result
is true if and only if the argument is not
null and is a VersionConstraint object that
it has the same normalized versions and version ranges as those of
this VersionConstraint.
equals in class Objectobj - the object to compare with.
public int hashCode()
VersionConstraint.
hashCode in class Objectpublic String toString()
String object representing this
VersionConstraint's value. The value is converted to the
version constraint format and returned as a string.
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||