Package org.datanucleus.metadata
Class ValueGenerationStrategy
- java.lang.Object
-
- org.datanucleus.metadata.ValueGenerationStrategy
-
- All Implemented Interfaces:
java.io.Serializable
public class ValueGenerationStrategy extends java.lang.Object implements java.io.SerializableValue 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.private java.lang.StringcustomNameThe Name of the custom type (if CUSTOM).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.private static longserialVersionUIDstatic 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.private inttypeIdThe type id.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.
-
Constructor Summary
Constructors Modifier Constructor Description privateValueGenerationStrategy(int i)constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetCustomName()Accessor for the custom name (if using strategy type of CUSTOM).static ValueGenerationStrategygetIdentityStrategy(java.lang.String value)Gets an IdentityStrategy for the given value argument.intgetType()Accessor for the type.inthashCode()java.lang.StringtoString()Returns a string representation of the object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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 java.lang.String customName
The Name of the custom type (if CUSTOM).
-
-
Method Detail
-
getCustomName
public java.lang.String getCustomName()
Accessor for the custom name (if using strategy type of CUSTOM).- Returns:
- Custom name
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the object.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the object.
-
getType
public int getType()
Accessor for the type.- Returns:
- Type
-
getIdentityStrategy
public static ValueGenerationStrategy getIdentityStrategy(java.lang.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
-
-