public final class Version extends Object implements Serializable
This class is Immutable.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Version |
expand(String qualifierDefault)
Expands the version to full dotted notation.
|
static Version |
fromDottedNotationWithFallback(String version)
Creates the version from the spec version string.
|
static Version |
fromJsr277NotationWithFallback(String version)
Creates the version from the spec version string.
|
static Version |
fromJsr277OrDottedNotationWithFallback(String version)
Creates the version from the spec version string.
|
Integer |
getMajor()
Returns the major number.
|
Integer |
getMicro()
Returns the micro number.
|
Integer |
getMinor()
Returns the minor number.
|
String |
getQualifier()
Returns the qualifier.
|
Integer |
getUpdate()
Returns the update.
|
int |
hashCode() |
boolean |
isAboveOrEqual(Version other) |
boolean |
isBelowOrEqual(Version other) |
String |
toString() |
@NonNull public static Version fromJsr277OrDottedNotationWithFallback(@NonNull String version)
MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER]]][-QUALIFIER]
or MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER[.QUALIFIER]]]]
or GENERIC_VERSION_STRING
. The string is evaluated in this order.version
- spec version string@NonNull public static Version fromJsr277NotationWithFallback(@NonNull String version)
MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER]]][-QUALIFIER]
or GENERIC_VERSION_STRING
.version
- spec version string with the following format:
MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER]]][-QUALIFIER]
or GENERIC_VERSION_STRING
@NonNull public static Version fromDottedNotationWithFallback(@NonNull String version)
MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER[.QUALIFIER]]]]
or GENERIC_VERSION_STRING
.version
- spec version string with the following format:
MAJOR_NUMBER[.MINOR_NUMBER[.MICRO_NUMBER[.UPDATE_NUMBER[.QUALIFIER]]]]
or GENERIC_VERSION_STRING
@CheckForNull public Integer getMajor()
null
.null
@CheckForNull public Integer getMinor()
null
.null
@CheckForNull public Integer getMicro()
null
.null
@CheckForNull public Integer getUpdate()
null
.null
@CheckForNull public String getQualifier()
null
.null
public boolean equals(Object obj)
Two versions are equal if and only if they have same major, minor, micro, update number and qualifier. If the version does not conform to notation the versions are equal only if the version strings exactly matches.
public int hashCode()
The implementation consistent with Version.equals(Object)
.
public boolean isAboveOrEqual(Version other)
public boolean isBelowOrEqual(Version other)