- java.lang.Object
-
- org.datanucleus.identity.IdentityManagerImpl
-
- All Implemented Interfaces:
IdentityManager
public class IdentityManagerImpl extends Object implements IdentityManager
Manager for identity operations.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassdatastoreIdClassDefault DatastoreId implementation used by DataNucleus.protected IdentityKeyTranslatoridKeyTranslatorIdentity key translator (if any).protected IdentityStringTranslatoridStringTranslatorIdentity string translator (if any).-
Fields inherited from interface org.datanucleus.identity.IdentityManager
IDENTITY_CLASS_TARGET_CLASS_NAME_FIELD
-
-
Constructor Summary
Constructors Constructor Description IdentityManagerImpl(PersistenceNucleusContext nucCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetApplicationId(Class cls, Object key)Method to return a new object identity for the specified class, and key (possibly toString() output).ObjectgetApplicationId(Object pc, AbstractClassMetaData cmd)Method to create a new (application) identity for the passed object with the supplied MetaData (when using APPLICATION identity).ObjectgetApplicationId(ClassLoaderResolver clr, AbstractClassMetaData acmd, String keyToString)Utility to create a new application identity when you know the metadata for the target class, and the toString() output of the identity.protected StringgetConstructorNameForCache(Class type, Class[] ctrArgTypes)DatastoreIdgetDatastoreId(long value)Method to return a datastore-unique datastore identity, with the specified value.DatastoreIdgetDatastoreId(String idString)Method to return a datastore identity, for the specified string which comes from the output of toString().DatastoreIdgetDatastoreId(String className, Object value)Method to return a datastore identity, representing the persistable object with specified class name and key value.ClassgetDatastoreIdClass()IdentityKeyTranslatorgetIdentityKeyTranslator()Accessor for the current identity key translator to use (if any).IdentityStringTranslatorgetIdentityStringTranslator()Accessor for the current identity string translator to use (if any).SingleFieldIdgetSingleFieldId(Class idType, Class pcType, Object key)Utility to create a new SingleFieldId using reflection when you know the type of the Persistable, and also which SingleFieldId type, and the value of the key.
-
-
-
Field Detail
-
datastoreIdClass
protected Class datastoreIdClass
Default DatastoreId implementation used by DataNucleus.
-
idStringTranslator
protected IdentityStringTranslator idStringTranslator
Identity string translator (if any).
-
idKeyTranslator
protected IdentityKeyTranslator idKeyTranslator
Identity key translator (if any).
-
-
Constructor Detail
-
IdentityManagerImpl
public IdentityManagerImpl(PersistenceNucleusContext nucCtx)
-
-
Method Detail
-
getConstructorNameForCache
protected String getConstructorNameForCache(Class type, Class[] ctrArgTypes)
-
getDatastoreIdClass
public Class getDatastoreIdClass()
- Specified by:
getDatastoreIdClassin interfaceIdentityManager
-
getIdentityStringTranslator
public IdentityStringTranslator getIdentityStringTranslator()
Description copied from interface:IdentityManagerAccessor for the current identity string translator to use (if any).- Specified by:
getIdentityStringTranslatorin interfaceIdentityManager- Returns:
- Identity string translator instance (or null if persistence property not set)
-
getIdentityKeyTranslator
public IdentityKeyTranslator getIdentityKeyTranslator()
Description copied from interface:IdentityManagerAccessor for the current identity key translator to use (if any).- Specified by:
getIdentityKeyTranslatorin interfaceIdentityManager- Returns:
- Identity key translator instance (or null if persistence property not set)
-
getDatastoreId
public DatastoreId getDatastoreId(String className, Object value)
Description copied from interface:IdentityManagerMethod to return a datastore identity, representing the persistable object with specified class name and key value.- Specified by:
getDatastoreIdin interfaceIdentityManager- Parameters:
className- The class name for the persistablevalue- The key value for the persistable- Returns:
- The datastore id
-
getDatastoreId
public DatastoreId getDatastoreId(long value)
Description copied from interface:IdentityManagerMethod to return a datastore-unique datastore identity, with the specified value.- Specified by:
getDatastoreIdin interfaceIdentityManager- Parameters:
value- The long value that is unique across the datastore.- Returns:
- The datastore id
-
getDatastoreId
public DatastoreId getDatastoreId(String idString)
Description copied from interface:IdentityManagerMethod to return a datastore identity, for the specified string which comes from the output of toString().- Specified by:
getDatastoreIdin interfaceIdentityManager- Parameters:
idString- The toString() value- Returns:
- The datastore id
-
getSingleFieldId
public SingleFieldId getSingleFieldId(Class idType, Class pcType, Object key)
Utility to create a new SingleFieldId using reflection when you know the type of the Persistable, and also which SingleFieldId type, and the value of the key.- Specified by:
getSingleFieldIdin interfaceIdentityManager- Parameters:
idType- Type of SingleFieldIdpcType- Type of the Persistablekey- The value for the identity (the Long, or Int, or ... etc).- Returns:
- Single field identity
- Throws:
NucleusException- if invalid input is received
-
getApplicationId
public Object getApplicationId(ClassLoaderResolver clr, AbstractClassMetaData acmd, String keyToString)
Utility to create a new application identity when you know the metadata for the target class, and the toString() output of the identity.- Specified by:
getApplicationIdin interfaceIdentityManager- Parameters:
clr- ClassLoader resolveracmd- MetaData for the target classkeyToString- String form of the key- Returns:
- The identity
-
getApplicationId
public Object getApplicationId(Object pc, AbstractClassMetaData cmd)
Method to create a new (application) identity for the passed object with the supplied MetaData (when using APPLICATION identity).- Specified by:
getApplicationIdin interfaceIdentityManager- Parameters:
pc- The persistable objectcmd- Metadata for the persistable object- Returns:
- The new identity object
-
getApplicationId
public Object getApplicationId(Class cls, Object key)
Method to return a new object identity for the specified class, and key (possibly toString() output).- Specified by:
getApplicationIdin interfaceIdentityManager- Parameters:
cls- Persistable classkey- form of the object id- Returns:
- The object identity
-
-