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 JavaVersionJAVA_SPECIFICATION_VERSIONRepresents the System propertyjava.specification.versionstatic JavaVersionJAVA_VERSIONRepresents the System propertyjava.versionprivate java.lang.StringrawVersionprivate static java.util.regex.PatternstartingDigits
-
Constructor Summary
Constructors Modifier Constructor Description privateJavaVersion(java.lang.String rawVersion)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JavaVersion other)booleanequals(java.lang.Object obj)inthashCode()booleanisAtLeast(java.lang.String other)Verify if this version is at least some other versionbooleanisAtLeast(JavaVersion other)Verify if this version is at least some other versionbooleanisBefore(java.lang.String other)Verify if this version is before some other versionbooleanisBefore(JavaVersion other)Verify if this version is before some other versionstatic JavaVersionparse(java.lang.String s)Lazy parse the version-scheme.private intsuffixRate(java.lang.String suffix)java.lang.StringtoString()
-
-
-
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:
compareToin 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:
trueis 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:
trueis 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:
trueis 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:
trueis this is greater than or equal toother, otherwisefalse
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-