Module org.eclipse.persistence.core
Class JavaVersion
java.lang.Object
org.eclipse.persistence.internal.helper.JavaVersion
Java version storage class. Used for version numbers retrieved from
Java specification version string. Stored version is in
<major>.<minor>
format.-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
JavaEE platform patch version element separator character.static final char
JavaEE platform version elements separator character.static final String
Java VM version system property name. -
Constructor Summary
ConstructorDescriptionJavaVersion
(int major, int minor) Constructs an instance of Java specification version number. -
Method Summary
Modifier and TypeMethodDescriptionint
comapreTo
(JavaVersion version) Compares thisJavaVersion
object against another one.int
getMajor()
Get major version number.int
getMinor()
Get minor version number.ReturnJavaSEPlatform
matching this Java SE specification version.toString()
ReturnString
representation of Java VM version object.static JavaVersion
Java specification version detector.static String
Retrieves Java specification version String from JDK system property.
-
Field Details
-
SEPARATOR
public static final char SEPARATORJavaEE platform version elements separator character.- See Also:
-
PATCH_SEPARATOR
public static final char PATCH_SEPARATORJavaEE platform patch version element separator character.- See Also:
-
VM_VERSION_PROPERTY
Java VM version system property name.- See Also:
-
-
Constructor Details
-
JavaVersion
public JavaVersion(int major, int minor) Constructs an instance of Java specification version number.- Parameters:
major
- Major version number.minor
- Minor version number.
-
-
Method Details
-
vmVersionString
Retrieves Java specification version String from JDK system property.- Returns:
- Java specification version String from JDK system property.
-
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
Compares thisJavaVersion
object against another one.- Parameters:
version
-JavaVersion
object to compare withthis
object.- Returns:
- Compare result:
- Value
1
ifthis
value is greater than suppliedversion
value. - Value
-1
ifthis
value is lesser than suppliedversion
value. - Value
0
if boththis
value and suppliedversion
values are equal.
- Value
-
toString
ReturnString
representation of Java VM version object. -
toPlatform
ReturnJavaSEPlatform
matching this Java SE specification version.- Returns:
JavaSEPlatform
matching this Java SE specification version orJavaSEPlatform.DEFAULT
as default when platform matching fails.
-