Class JavaVersion
- java.lang.Object
-
- org.codehaus.plexus.languages.java.version.JavaVersion
-
- All Implemented Interfaces:
java.lang.Comparable<JavaVersion>
public class JavaVersion extends java.lang.Object implements java.lang.Comparable<JavaVersion>
- Since:
- 1.0.0
- See Also:
- Java SE Naming and Versions, JEP 223: New Version-String Scheme, JEP 322: Time-Based Release Versioning
-
-
Field Summary
Fields Modifier and Type Field Description static JavaVersion
JAVA_SPECIFICATION_VERSION
Represents the System propertyjava.specification.version
static JavaVersion
JAVA_VERSION
Represents the System propertyjava.version
private java.lang.String
rawVersion
private static java.util.regex.Pattern
startingDigits
-
Constructor Summary
Constructors Modifier Constructor Description private
JavaVersion(java.lang.String rawVersion)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(JavaVersion other)
boolean
equals(java.lang.Object obj)
int
hashCode()
boolean
isAtLeast(java.lang.String other)
Verify if this version is at least some other versionboolean
isAtLeast(JavaVersion other)
Verify if this version is at least some other versionboolean
isBefore(java.lang.String other)
Verify if this version is before some other versionboolean
isBefore(JavaVersion other)
Verify if this version is before some other versionstatic JavaVersion
parse(java.lang.String s)
Lazy parse the version-scheme.private int
suffixRate(java.lang.String suffix)
java.lang.String
toString()
-
-
-
Field Detail
-
JAVA_SPECIFICATION_VERSION
public static final JavaVersion JAVA_SPECIFICATION_VERSION
Represents the System propertyjava.specification.version
-
JAVA_VERSION
public static final JavaVersion JAVA_VERSION
Represents the System propertyjava.version
-
startingDigits
private static final java.util.regex.Pattern startingDigits
-
rawVersion
private java.lang.String rawVersion
-
-
Method Detail
-
parse
public static JavaVersion parse(java.lang.String s)
Lazy parse the version-scheme. Actual parsing is done when callingcompareTo(JavaVersion)
- Parameters:
s
- the version string- Returns:
- the version wrapped in a JavadocVersion
-
compareTo
public int compareTo(JavaVersion other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<JavaVersion>
-
suffixRate
private int suffixRate(java.lang.String suffix)
-
isBefore
public boolean isBefore(JavaVersion other)
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
public boolean isBefore(java.lang.String other)
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
public boolean isAtLeast(JavaVersion other)
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
public boolean isAtLeast(java.lang.String other)
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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-