Module org.eclipse.persistence.core
Class JavaVersion
- java.lang.Object
-
- org.eclipse.persistence.internal.helper.JavaVersion
-
public final class JavaVersion extends Object
Java version storage class. Used for version numbers retrieved from Java specification version string. Stored version is in<major>.<minor>format.- Author:
- Tomas Kraus, Peter Benedikovic
-
-
Field Summary
Fields Modifier and Type Field Description static charPATCH_SEPARATORJavaEE platform patch version element separator character.static charSEPARATORJavaEE platform version elements separator character.static StringVM_VERSION_PROPERTYJava VM version system property name.
-
Constructor Summary
Constructors Constructor Description JavaVersion(int major, int minor)Constructs an instance of Java specification version number.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcomapreTo(JavaVersion version)Compares thisJavaVersionobject against another one.intgetMajor()Get major version number.intgetMinor()Get minor version number.JavaSEPlatformtoPlatform()ReturnJavaSEPlatformmatching this Java SE specification version.StringtoString()ReturnStringrepresentation of Java VM version object.static JavaVersionvmVersion()Java specification version detector.static StringvmVersionString()Retrieves Java specification version String from JDK system property.
-
-
-
Field Detail
-
SEPARATOR
public static final char SEPARATOR
JavaEE platform version elements separator character.- See Also:
- Constant Field Values
-
PATCH_SEPARATOR
public static final char PATCH_SEPARATOR
JavaEE platform patch version element separator character.- See Also:
- Constant Field Values
-
VM_VERSION_PROPERTY
public static final String VM_VERSION_PROPERTY
Java VM version system property name.- See Also:
- Constant Field Values
-
-
Method Detail
-
vmVersionString
public static String vmVersionString()
Retrieves Java specification version String from JDK system property.- Returns:
- Java specification version String from JDK system property.
-
vmVersion
public static JavaVersion vmVersion()
Java specification version detector.
-
getMajor
public int getMajor()
Get major version number.- Returns:
- Major version number.
-
getMinor
public int getMinor()
Get minor version number.- Returns:
- Minor version number.
-
comapreTo
public int comapreTo(JavaVersion version)
Compares thisJavaVersionobject against another one.- Parameters:
version-JavaVersionobject to compare withthisobject.- Returns:
- Compare result:
- Value
1ifthisvalue is greater than suppliedversionvalue. - Value
-1ifthisvalue is lesser than suppliedversionvalue. - Value
0if boththisvalue and suppliedversionvalues are equal.
- Value
-
toString
public String toString()
ReturnStringrepresentation of Java VM version object.
-
toPlatform
public JavaSEPlatform toPlatform()
ReturnJavaSEPlatformmatching this Java SE specification version.- Returns:
JavaSEPlatformmatching this Java SE specification version orJavaSEPlatform.DEFAULTas default when platform matching fails.
-
-