Package org.apache.openjpa.persistence
Class JPAProperties
java.lang.Object
org.apache.openjpa.persistence.JPAProperties
Enumerates configuration property keys defined in JPA 2.0 Specification.
Provides static utility functions to read their values from supplied map of properties.
Provides static utility functions to convert them to values that are fit for OpenJPA implementation.
Provides static utility functions to read their values from supplied map of properties.
Provides static utility functions to convert them to values that are fit for OpenJPA implementation.
- Since:
- 2.0.0
- Author:
- Pinaki Poddar
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
convertToKernelValue
(Class<T> resultType, String key, Object value) Convert the given user value to a value consumable by OpenJPA kernel constructs.static Object
convertToUserValue
(String key, Object value) Convert the given kernel value to a value visible to the user.static String
getBeanProperty
(String key) Gets a bean-style property name from the given key.static <E extends Enum<E>>
EgetEnumValue
(Class<E> type, E[] values, Object val) Gets a enum value of the given type from the given value.static <E extends Enum<E>>
EGets a enum value of the given type from the given properties looking up with the given key.static <E extends Enum<E>>
EgetEnumValue
(Class<E> type, Object val) Gets a enum value of the given type from the given value.static <E extends Enum<E>>
EGet the value of the given key from the given properties after converting it to the given enumerated value.static boolean
isValidKey
(String key) Is the given key appears to be a valid JPA specification defined key?
-
Field Details
-
PREFIX
- See Also:
-
PROVIDER
- See Also:
-
TRANSACTION_TYPE
- See Also:
-
DATASOURCE
- See Also:
-
DATASOURCE_JTA
- See Also:
-
DATASOURCE_NONJTA
- See Also:
-
JDBC_DRIVER
- See Also:
-
JDBC_URL
- See Also:
-
JDBC_USER
- See Also:
-
JDBC_PASSWORD
- See Also:
-
LOCK_SCOPE
- See Also:
-
LOCK_TIMEOUT
- See Also:
-
QUERY_TIMEOUT
- See Also:
-
CACHE_MODE
- See Also:
-
CACHE_STORE_MODE
- See Also:
-
CACHE_RETRIEVE_MODE
- See Also:
-
VALIDATE_FACTORY
- See Also:
-
VALIDATE_MODE
- See Also:
-
VALIDATE_PRE_PERSIST
- See Also:
-
VALIDATE_PRE_REMOVE
- See Also:
-
VALIDATE_PRE_UPDATE
- See Also:
-
VALIDATE_GROUP_DEFAULT
- See Also:
-
-
Constructor Details
-
JPAProperties
public JPAProperties()
-
-
Method Details
-
isValidKey
Is the given key appears to be a valid JPA specification defined key?- Returns:
- true if the given string merely prefixed with
jakarta.persistence.
. Does not really check all the keys defined in the specification.
-
getBeanProperty
Gets a bean-style property name from the given key.- Parameters:
key
- must begin with JPA property prefixjakarta.persistence
- Returns:
- concatenates each part of the string leaving out
jakarta.persistence.
prefix. Part of string is what appears between DOT character.
-
convertToKernelValue
Convert the given user value to a value consumable by OpenJPA kernel constructs.- Returns:
- the same value if the given key is not a valid JPA property key or the value is null.
-
convertToUserValue
Convert the given kernel value to a value visible to the user.- Returns:
- the same value if the given key is not a valid JPA property key or the value is null.
-
getEnumValue
public static <E extends Enum<E>> E getEnumValue(Class<E> type, String key, Map<String, Object> prop) Get the value of the given key from the given properties after converting it to the given enumerated value. -
getEnumValue
public static <E extends Enum<E>> E getEnumValue(Class<E> type, E[] values, String key, Map<String, Object> prop) Gets a enum value of the given type from the given properties looking up with the given key. Converts the original value from a String or ordinal number, if necessary. Conversion from an integral number to enum value is only attempted if the allowed enum values are provided as non-null, non-empty array.- Returns:
- null if the key does not exist in the given properties.
-
getEnumValue
Gets a enum value of the given type from the given value. Converts the original value from a String, if necessary.- Returns:
- null if the key does not exist in the given properties.
-
getEnumValue
Gets a enum value of the given type from the given value. Converts the original value from a String or ordinal number, if necessary. Conversion from an integral number to enum value is only attempted if the allowed enum values are provided as non-null, non-empty array.- Returns:
- null if the key does not exist in the given properties.
-