org.jpox.util
Class AIDUtils

java.lang.Object
  extended byorg.jpox.util.AIDUtils

public class AIDUtils
extends java.lang.Object

Application Identity 'id' utils.

Version:
$Revision: 1.13 $

Method Summary
static java.lang.Object getNewObjectId(javax.jdo.spi.PersistenceCapable pc, AbstractClassMetaData cmd)
          Create a new ObjectId instance and copy the key fields from the persistence capable instance to the objectId instance
static javax.jdo.identity.SingleFieldIdentity getNewSingleFieldIdentity(java.lang.Class idType, java.lang.Class pcType, java.lang.Object value)
          Utility to create a new SingleFieldIdentity using reflection when you know the type of the PersistenceCapable, and also which SingleFieldIdentity, and the value of the key.
static java.lang.Object getPKFieldValueFromId(java.lang.Object id, int fieldNumber, AbstractClassMetaData cmd)
          Method to extract the value for a field of a PK from the identity object.
static boolean isSingleFieldIdentityClass(java.lang.String className)
          Checks whether the argument is equals to one the single field identity class names
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPKFieldValueFromId

public static java.lang.Object getPKFieldValueFromId(java.lang.Object id,
                                                     int fieldNumber,
                                                     AbstractClassMetaData cmd)
Method to extract the value for a field of a PK from the identity object.

Parameters:
id - The identity value
fieldNumber - Absolute field number of the field
cmd - MetaData for the class that this id pertains to
Returns:
Value for the PK field

getNewObjectId

public static java.lang.Object getNewObjectId(javax.jdo.spi.PersistenceCapable pc,
                                              AbstractClassMetaData cmd)
Create a new ObjectId instance and copy the key fields from the persistence capable instance to the objectId instance

Parameters:
pc - The persistence capable object
cmd - The AbstractClassMetaData
Returns:
The object id for the persistence capable object

getNewSingleFieldIdentity

public static javax.jdo.identity.SingleFieldIdentity getNewSingleFieldIdentity(java.lang.Class idType,
                                                                               java.lang.Class pcType,
                                                                               java.lang.Object value)
Utility to create a new SingleFieldIdentity using reflection when you know the type of the PersistenceCapable, and also which SingleFieldIdentity, and the value of the key.

Parameters:
idType - Type of SingleFieldIdentity
pcType - Type of the PersistenceCapable
value - The value for the identity (the Long, or Int, or ... etc).
Returns:
The SingleFieldIdentity key

isSingleFieldIdentityClass

public static boolean isSingleFieldIdentityClass(java.lang.String className)
Checks whether the argument is equals to one the single field identity class names

Parameters:
className - the full class name
Returns:
true if the argument is equals to one the single field identity class names


Copyright © -2007 . All Rights Reserved.