Class JavaVersion
java.lang.Object
org.codehaus.plexus.languages.java.version.JavaVersion
- All Implemented Interfaces:
Comparable<JavaVersion>
- Since:
- 1.0.0
- Author:
- Robert Scholte
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final JavaVersion
Represents the System propertyjava.specification.version
static final JavaVersion
Represents the System propertyjava.version
-
Method Summary
Modifier and TypeMethodDescriptionasMajor()
If original version starts with"1."
, then remove this part from the versionint
compareTo
(JavaVersion other) boolean
getValue()
Returns the original versiongetValue
(int groups) Returns a value respecting the nuber of groups.
If the original has more groups, the end of that value will be removed.
If the original has less groups, the value will be extended this ".0".int
hashCode()
boolean
Verify if this version is at least some other versionboolean
isAtLeast
(JavaVersion other) Verify if this version is at least some other versionboolean
Verify if this version is before some other versionboolean
isBefore
(JavaVersion other) Verify if this version is before some other versionstatic JavaVersion
Lazy parse the version-scheme.toString()
-
Field Details
-
JAVA_SPECIFICATION_VERSION
Represents the System propertyjava.specification.version
-
JAVA_VERSION
Represents the System propertyjava.version
-
-
Method Details
-
parse
Lazy parse the version-scheme. Actual parsing is done when callingcompareTo(JavaVersion)
- Parameters:
s
- the version string, nevernull
- Returns:
- the version wrapped in a JavaVersion
-
compareTo
- Specified by:
compareTo
in interfaceComparable<JavaVersion>
-
isBefore
Verify if this version is before some other version- Parameters:
other
- the version to compare with- Returns:
true
is this is less thanother
, otherwisefalse
-
isBefore
Verify if this version is before some other version- Parameters:
other
- the version to compare with- Returns:
true
is this is less thanother
, otherwisefalse
-
isAtLeast
Verify if this version is at least some other version- Parameters:
other
- the version to compare with- Returns:
true
is this is greater than or equal toother
, otherwisefalse
-
isAtLeast
Verify if this version is at least some other version- Parameters:
other
- the version to compare with- Returns:
true
is this is greater than or equal toother
, otherwisefalse
-
asMajor
If original version starts with"1."
, then remove this part from the version- Returns:
- a new JavaVersion if version has to be changed, otherwise return itself
-
getValue
Returns the original version- Returns:
- the raw version
-
getValue
Returns a value respecting the nuber of groups.
If the original has more groups, the end of that value will be removed.
If the original has less groups, the value will be extended this ".0".
JavaVersion.parse( "1" ).getValue( 1 ) is "1" JavaVersion.parse( "1" ).getValue( 2 ) is "1.0" JavaVersion.parse( "2.1" ).getValue( 1 ) is "2" JavaVersion.parse( "2.1" ).getValue( 2 ) is "2.1"
- Parameters:
groups
- number of groups to return- Returns:
- the version respecting the number of groups
-
toString
-
hashCode
public int hashCode() -
equals
-