Package org.datanucleus.metadata
Class ValueGenerationStrategy
java.lang.Object
org.datanucleus.metadata.ValueGenerationStrategy
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionstatic final ValueGenerationStrategy
The value "auid" specifies a strategy that is a Java implementation of DCE UUIDs, and represents the results as a 36-character String.static final ValueGenerationStrategy
Extension strategy, that will have the "customName" set to the chosen strategy.private String
The Name of the custom type (if CUSTOM).static final ValueGenerationStrategy
The value "identity" specifies that the column identified as the key column is managed by the database as an auto-incrementing identity type.static final ValueGenerationStrategy
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 final ValueGenerationStrategy
The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.static final ValueGenerationStrategy
The value "sequence" specifies that a named database sequence is used to generate key values for the table.private static final long
static final ValueGenerationStrategy
The value "timestamp" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Timestamp object.static final ValueGenerationStrategy
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.static final ValueGenerationStrategy
The value "uuid" specifies a strategy that uses the Java "UUID" class, and represents the results as a 36-character String.static final ValueGenerationStrategy
The value "uuid-object" specifies a strategy that uses the Java "UUID" class, and represents the results as a UUID object.static final ValueGenerationStrategy
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 final ValueGenerationStrategy
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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
Accessor for the custom name (if using strategy type of CUSTOM).static ValueGenerationStrategy
getIdentityStrategy
(String value) Gets an IdentityStrategy for the given value argument.int
getType()
Accessor for the type.int
hashCode()
toString()
Returns a string representation of the object.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
NATIVE
The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database. -
SEQUENCE
The value "sequence" specifies that a named database sequence is used to generate key values for the table. -
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
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
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
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
The value "auid" specifies a strategy that is a Java implementation of DCE UUIDs, and represents the results as a 36-character String. -
UUID
The value "uuid" specifies a strategy that uses the Java "UUID" class, and represents the results as a 36-character String. -
UUID_OBJECT
The value "uuid-object" specifies a strategy that uses the Java "UUID" class, and represents the results as a UUID object. -
TIMESTAMP
The value "timestamp" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Timestamp object. -
TIMESTAMP_VALUE
The value "timestamp-value" specifies a strategy that uses the Java "Timestamp" class, and represents the results as a Long. -
CUSTOM
Extension strategy, that will have the "customName" set to the chosen strategy. -
typeId
private final int typeIdThe type id. -
customName
The Name of the custom type (if CUSTOM).
-
-
Constructor Details
-
ValueGenerationStrategy
private ValueGenerationStrategy(int i) constructor- Parameters:
i
- type id
-
-
Method Details
-
getCustomName
Accessor for the custom name (if using strategy type of CUSTOM).- Returns:
- Custom name
-
hashCode
public int hashCode() -
equals
-
toString
Returns a string representation of the object. -
getType
public int getType()Accessor for the type.- Returns:
- Type
-
getIdentityStrategy
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
-