Package org.eclipse.persistence.jpa.jpql
Enum JPAVersion
- java.lang.Object
-
- java.lang.Enum<JPAVersion>
-
- org.eclipse.persistence.jpa.jpql.JPAVersion
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<JPAVersion>
public enum JPAVersion extends java.lang.Enum<JPAVersion>
An enumeration listing the various releases of the Java Persistence specification.Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
- Version:
- 2.5
- Author:
- Pascal Filion
- Since:
- 2.3
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DEFAULT_VERSION
The constant for the default version used by the parsing system, which is always the latest version of the Java Persistence functional specification, which is version 2.0.VERSION_1_0
The constant for the Java Persistence specification 1.0.VERSION_2_0
The constant for the Java Persistence specification 2.0.VERSION_2_1
The constant for the Java Persistence specification 2.1.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getVersion()
Returns the real version this constant represents.boolean
isNewerThan(JPAVersion version)
Determines whether this constant represents a version that is newer than the given version.boolean
isNewerThanOrEqual(JPAVersion version)
Determines whether this constant represents a version that is newer than the given version or if it's the same version.boolean
isOlderThan(JPAVersion version)
Determines whether this constant represents a version that is older than the given version.boolean
isOlderThanOrEqual(JPAVersion version)
Determines whether this constant represents a version that is older than the given version or if it's the same version.JPAVersion
toCurrentVersion()
Converts the current constant to one of the known versions, this means if the constant isDEFAULT_VERSION
, then it will be converted into the actual constant representing that version.java.lang.String
toString()
static JPAVersion
value(java.lang.String value)
Retrieves the enumeration constant for the given value.static JPAVersion
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static JPAVersion[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.static JPAVersion[]
versions()
Returns the list ofJPAVersion
excludingDEFAULT_VERSION
.
-
-
-
Enum Constant Detail
-
DEFAULT_VERSION
public static final JPAVersion DEFAULT_VERSION
The constant for the default version used by the parsing system, which is always the latest version of the Java Persistence functional specification, which is version 2.0.
-
VERSION_1_0
public static final JPAVersion VERSION_1_0
The constant for the Java Persistence specification 1.0.
-
VERSION_2_0
public static final JPAVersion VERSION_2_0
The constant for the Java Persistence specification 2.0.
-
VERSION_2_1
public static final JPAVersion VERSION_2_1
The constant for the Java Persistence specification 2.1.
-
-
Method Detail
-
values
public static JPAVersion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (JPAVersion c : JPAVersion.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JPAVersion valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
value
public static JPAVersion value(java.lang.String value)
Retrieves the enumeration constant for the given value. If the value is not known, thenDEFAULT_VERSION
will be returned.- Parameters:
value
- The value to retrieve its constant version- Returns:
- The constant version of the given value
-
versions
public static JPAVersion[] versions()
Returns the list ofJPAVersion
excludingDEFAULT_VERSION
.- Returns:
- The list of unique constants
-
getVersion
public java.lang.String getVersion()
Returns the real version this constant represents.- Returns:
- The string value of the version
-
isNewerThan
public boolean isNewerThan(JPAVersion version)
Determines whether this constant represents a version that is newer than the given version.- Parameters:
version
- The constant to verify if it's representing a version that is older than this one- Returns:
true
if this constant represents a newer version and the given constant represents a version that is older;false
if the given constant represents a newer and this constant represents an older version
-
isNewerThanOrEqual
public boolean isNewerThanOrEqual(JPAVersion version)
Determines whether this constant represents a version that is newer than the given version or if it's the same version.- Parameters:
version
- The constant to verify if it's representing a version that is older than this one or if it's the same than this one- Returns:
true
if this constant represents a newer version and the given constant represents a version that is older or if it's the same constant;false
if the given constant represents a newer and this constant represents an older version
-
isOlderThan
public boolean isOlderThan(JPAVersion version)
Determines whether this constant represents a version that is older than the given version.- Parameters:
version
- The constant to verify if it's representing a version that is more recent than this one- Returns:
true
if this constant represents an earlier version and the given constant represents a version that is more recent;false
if the given constant represents an earlier version and this constant represents a more recent version
-
isOlderThanOrEqual
public boolean isOlderThanOrEqual(JPAVersion version)
Determines whether this constant represents a version that is older than the given version or if it's the same version.- Parameters:
version
- The constant to verify if it's representing a version that is more recent than this one or if it's the same than this one- Returns:
true
if this constant represents an earlier version and the given constant represents a version that is more recent or if it's the same constant;false
if the given constant represents an earlier version and this constant represents a more recent version
-
toCurrentVersion
public JPAVersion toCurrentVersion()
Converts the current constant to one of the known versions, this means if the constant isDEFAULT_VERSION
, then it will be converted into the actual constant representing that version.- Returns:
- Either this same constant or the actual version constant
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<JPAVersion>
-
-