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.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 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.static ValueGenerationStrategy
CUSTOM
Extension strategy, that will have the "customName" set to the chosen strategy.private java.lang.String
customName
The Name of the custom type (if CUSTOM).static 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.static 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.static ValueGenerationStrategy
NATIVE
The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.static ValueGenerationStrategy
SEQUENCE
The value "sequence" specifies that a named database sequence is used to generate key values for the table.private static long
serialVersionUID
static ValueGenerationStrategy
TIMESTAMP
The value "timestamp" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Timestamp object.static ValueGenerationStrategy
TIMESTAMP_VALUE
The value "timestamp-value" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Long.private int
typeId
The type id.static ValueGenerationStrategy
UUID
The value "uuid" specifies a strategy that uses the Java "UUID" class, and represents the results as a 36-character String.static ValueGenerationStrategy
UUID_OBJECT
The value "uuid-object" specifies a strategy that uses the Java "UUID" class, and represents the results as a UUID object.static 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.static 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.
-
Constructor Summary
Constructors Modifier Constructor Description private
ValueGenerationStrategy(int i)
constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getCustomName()
Accessor for the custom name (if using strategy type of CUSTOM).static ValueGenerationStrategy
getIdentityStrategy(java.lang.String value)
Gets an IdentityStrategy for the given value argument.int
getType()
Accessor for the type.int
hashCode()
java.lang.String
toString()
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the object.- Overrides:
toString
in 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
-
-