Enum Class IdValueSource

java.lang.Object
java.lang.Enum<IdValueSource>
org.springframework.data.relational.core.conversion.IdValueSource
All Implemented Interfaces:
Serializable, Comparable<IdValueSource>, Constable

public enum IdValueSource extends Enum<IdValueSource>
Enumeration describing the source of a value for an id property.
Since:
2.4
Author:
Chirag Tailor
  • Enum Constant Details

    • PROVIDED

      public static final IdValueSource PROVIDED
      The id value is provided on the instance.
    • GENERATED

      public static final IdValueSource GENERATED
      The id value is generated by the store.
    • NONE

      public static final IdValueSource NONE
      There is no id property, and therefore no id value source.
  • Method Details

    • values

      public static IdValueSource[] 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

      public static IdValueSource valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • forInstance

      public static <T> IdValueSource forInstance(Object instance, RelationalPersistentEntity<T> persistentEntity)
      Returns the appropriate IdValueSource 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, and GENERATED otherwise.