Enum Class IdValueSource
- All Implemented Interfaces:
Serializable
,Comparable<IdValueSource>
,Constable
Enumeration describing the source of a value for an id property.
- Since:
- 2.4
- Author:
- Chirag Tailor
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> IdValueSource
forInstance
(Object instance, RelationalPersistentEntity<T> persistentEntity) Returns the appropriateIdValueSource
for the instance:NONE
when the entity has no id property,PROVIDED
when the value of the id property is not null and when it is a primitive type, not zero, andGENERATED
otherwise.static IdValueSource
Returns the enum constant of this class with the specified name.static IdValueSource[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PROVIDED
The id value is provided on the instance. -
GENERATED
The id value is generated by the store. -
NONE
There is no id property, and therefore no id value source.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
forInstance
public static <T> IdValueSource forInstance(Object instance, RelationalPersistentEntity<T> persistentEntity) Returns the appropriateIdValueSource
for the instance:NONE
when the entity has no id property,PROVIDED
when the value of the id property is not null and when it is a primitive type, not zero, andGENERATED
otherwise.
-