org.datanucleus.metadata
Class IdentityStrategy

java.lang.Object
  extended by org.datanucleus.metadata.IdentityStrategy
All Implemented Interfaces:
java.io.Serializable

public class IdentityStrategy
extends java.lang.Object
implements java.io.Serializable

Representation of the values for identity "strategy".

Since:
1.1
Version:
$Revision: 1.16 $
See Also:
Serialized Form

Field Summary
static IdentityStrategy CUSTOM
          An extension strategy not in the standard JDO/JPA list.
static IdentityStrategy IDENTITY
          strategy="identity" in JDO and JPA The value "identity" specifies that the column identified as the key column is managed by the database as an autoincrementing identity type.
static IdentityStrategy INCREMENT
          strategy="increment" in JDO and "table" in JPA 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 IdentityStrategy NATIVE
          strategy="native" in JDO, and "auto" in JPA The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.
static IdentityStrategy SEQUENCE
          strategy="sequence" in JDO and JPA The value "sequence" specifies that a named database sequence is used to generate key values for the table.
static IdentityStrategy UUIDHEX
          strategy="uuid-hex" The value "uuid-hex" specifies a strategy that generates a 128-bit UUID unique within a network (the IP address of the machine running the application is part of the id) and represents the result as a 32-character String.
static IdentityStrategy UUIDSTRING
          strategy="uuid-string" The value "uuid-string" specifies a strategy that generates a 128-bit UUID unique within a network (the IP address of the machine running the application is part of the id) and represents the result as a 16-character String.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
 java.lang.String getCustomName()
          Accessor for the custom name (if using strategy type of CUSTOM).
static IdentityStrategy getIdentityStrategy(java.lang.String value)
          Gets an IdentityStrategy for the given value argument.
 int getType()
          Accessor for the type.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NATIVE

public static final IdentityStrategy NATIVE
strategy="native" in JDO, and "auto" in JPA The value "native" allows the JDO implementation to pick the most suitable strategy based on the underlying database.


SEQUENCE

public static final IdentityStrategy SEQUENCE
strategy="sequence" in JDO and JPA The value "sequence" specifies that a named database sequence is used to generate key values for the table. If sequence is used, then the sequence-name attribute is required.


IDENTITY

public static final IdentityStrategy IDENTITY
strategy="identity" in JDO and JPA The value "identity" specifies that the column identified as the key column is managed by the database as an autoincrementing identity type.


INCREMENT

public static final IdentityStrategy INCREMENT
strategy="increment" in JDO and "table" in JPA The value "increment" specifies a strategy that simply finds the largest key already in the database and increments the key value for new instances. It can be used with integral column types when the JDO application is the only database user inserting new instances.


UUIDSTRING

public static final IdentityStrategy UUIDSTRING
strategy="uuid-string" The value "uuid-string" specifies a strategy that generates a 128-bit UUID unique within a network (the IP address of the machine running the application is part of the id) and represents the result as a 16-character String.


UUIDHEX

public static final IdentityStrategy UUIDHEX
strategy="uuid-hex" The value "uuid-hex" specifies a strategy that generates a 128-bit UUID unique within a network (the IP address of the machine running the application is part of the id) and represents the result as a 32-character String.


CUSTOM

public static final IdentityStrategy CUSTOM
An extension strategy not in the standard JDO/JPA list. Will have the "customName" set to the chosen strategy. This object only exists for use in the equals() method to check if something is CUSTOM.

Method Detail

getCustomName

public java.lang.String getCustomName()
Accessor for the custom name (if using strategy type of CUSTOM).

Returns:
Custom name

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

getType

public int getType()
Accessor for the type.

Returns:
Type

getIdentityStrategy

public static IdentityStrategy 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


Copyright © 2009. All Rights Reserved.