Class ValueGenerationStrategy

java.lang.Object
org.datanucleus.metadata.ValueGenerationStrategy
All Implemented Interfaces:
Serializable

public class ValueGenerationStrategy extends Object implements Serializable
Value generation "strategy". Would have been nice to have this as an enum, but we need to allow for CUSTOM types
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The value "auid" specifies a strategy that is a Java implementation of DCE UUIDs, and represents the results as a 36-character String.
    Extension strategy, that will have the "customName" set to the chosen strategy.
    private String
    The Name of the custom type (if CUSTOM).
    The value "identity" specifies that the column identified as the key column is managed by the database as an auto-incrementing identity type.
    The value "increment" specifies a strategy that simply finds the largest key already in the database and increments the key value for new instances.
    The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.
    The value "sequence" specifies that a named database sequence is used to generate key values for the table.
    private static final long
     
    The value "timestamp" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Timestamp object.
    The value "timestamp-value" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Long.
    private final int
    The type id.
    The value "uuid" specifies a strategy that uses the Java "UUID" class, and represents the results as a 36-character String.
    The value "uuid-object" specifies a strategy that uses the Java "UUID" class, and represents the results as a UUID object.
    The value "uuid-hex" specifies a strategy that generates a 128-bit UUID unique within a network, and represents the result as a 32-character String.
    The value "uuid-string" specifies a strategy that generates a 128-bit UUID unique within a network, and represents the result as a 16-character String.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Accessor for the custom name (if using strategy type of CUSTOM).
    Gets an IdentityStrategy for the given value argument.
    int
    Accessor for the type.
    int
     
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • NATIVE

      public static final ValueGenerationStrategy NATIVE
      The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.
    • SEQUENCE

      public static final ValueGenerationStrategy SEQUENCE
      The value "sequence" specifies that a named database sequence is used to generate key values for the table.
    • IDENTITY

      public static final ValueGenerationStrategy IDENTITY
      The value "identity" specifies that the column identified as the key column is managed by the database as an auto-incrementing identity type.
    • INCREMENT

      public static final ValueGenerationStrategy INCREMENT
      The value "increment" specifies a strategy that simply finds the largest key already in the database and increments the key value for new instances.
    • UUIDSTRING

      public static final ValueGenerationStrategy UUIDSTRING
      The value "uuid-string" specifies a strategy that generates a 128-bit UUID unique within a network, and represents the result as a 16-character String.
    • UUIDHEX

      public static final ValueGenerationStrategy UUIDHEX
      The value "uuid-hex" specifies a strategy that generates a 128-bit UUID unique within a network, and represents the result as a 32-character String.
    • AUID

      public static final ValueGenerationStrategy AUID
      The value "auid" specifies a strategy that is a Java implementation of DCE UUIDs, and represents the results as a 36-character String.
    • UUID

      public static final ValueGenerationStrategy UUID
      The value "uuid" specifies a strategy that uses the Java "UUID" class, and represents the results as a 36-character String.
    • UUID_OBJECT

      public static final ValueGenerationStrategy UUID_OBJECT
      The value "uuid-object" specifies a strategy that uses the Java "UUID" class, and represents the results as a UUID object.
    • TIMESTAMP

      public static final ValueGenerationStrategy TIMESTAMP
      The value "timestamp" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Timestamp object.
    • TIMESTAMP_VALUE

      public static final ValueGenerationStrategy TIMESTAMP_VALUE
      The value "timestamp-value" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Long.
    • CUSTOM

      public static final ValueGenerationStrategy CUSTOM
      Extension strategy, that will have the "customName" set to the chosen strategy.
    • typeId

      private final int typeId
      The type id.
    • customName

      private String customName
      The Name of the custom type (if CUSTOM).
  • Constructor Details

    • ValueGenerationStrategy

      private ValueGenerationStrategy(int i)
      constructor
      Parameters:
      i - type id
  • Method Details

    • getCustomName

      public String getCustomName()
      Accessor for the custom name (if using strategy type of CUSTOM).
      Returns:
      Custom name
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.
    • getType

      public int getType()
      Accessor for the type.
      Returns:
      Type
    • getIdentityStrategy

      public static ValueGenerationStrategy getIdentityStrategy(String value)
      Gets an IdentityStrategy for the given value argument.
      Parameters:
      value - the String representation of IdentityStrategy
      Returns:
      the IdentityStrategy corresponding to the value argument. NATIVE IdentityStrategy is returned if the value argument is null or no corresponding strategy was found