- 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ValueGenerationStrategyAUIDThe value "auid" specifies a strategy that is a Java implementation of DCE UUIDs, and represents the results as a 36-character String.static ValueGenerationStrategyCUSTOMExtension strategy, that will have the "customName" set to the chosen strategy.static ValueGenerationStrategyIDENTITYThe value "identity" specifies that the column identified as the key column is managed by the database as an auto-incrementing identity type.static ValueGenerationStrategyINCREMENTThe value "increment" specifies a strategy that simply finds the largest key already in the database and increments the key value for new instances.static ValueGenerationStrategyNATIVEThe value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.static ValueGenerationStrategySEQUENCEThe value "sequence" specifies that a named database sequence is used to generate key values for the table.static ValueGenerationStrategyTIMESTAMPThe value "timestamp" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Timestamp object.static ValueGenerationStrategyTIMESTAMP_VALUEThe value "timestamp-value" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Long.static ValueGenerationStrategyUUIDThe value "uuid" specifies a strategy that uses the Java "UUID" class, and represents the results as a 36-character String.static ValueGenerationStrategyUUID_OBJECTThe value "uuid-object" specifies a strategy that uses the Java "UUID" class, and represents the results as a UUID object.static ValueGenerationStrategyUUIDHEXThe 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.static ValueGenerationStrategyUUIDSTRINGThe 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetCustomName()Accessor for the custom name (if using strategy type of CUSTOM).static ValueGenerationStrategygetIdentityStrategy(String value)Gets an IdentityStrategy for the given value argument.intgetType()Accessor for the type.inthashCode()StringtoString()Returns a string representation of the object.
-
-
-
Field Detail
-
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.
-
-
Method Detail
-
getCustomName
public String getCustomName()
Accessor for the custom name (if using strategy type of CUSTOM).- Returns:
- Custom name
-
toString
public String toString()
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
-
-