public class IdentityUtils extends Object
Constructor and Description |
---|
IdentityUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
getApplicationIdentityForResultSetRow(ExecutionContext ec,
AbstractClassMetaData cmd,
Class pcClass,
boolean inheritanceCheck,
FieldManager resultsFM)
Method to return the object application identity for a row of the result set.
|
static Class |
getKeyTypeForSingleFieldIdentityType(Class idType)
Accessor for the type of the single field application-identity key given the single field identity type.
|
static Object |
getObjectFromIdString(String idStr,
AbstractClassMetaData cmd,
ExecutionContext ec,
boolean checkInheritance)
Convenience method to find an object given a string form of its identity, and the metadata for the class (or a superclass).
|
static Object |
getObjectFromIdString(String idStr,
AbstractMemberMetaData mmd,
FieldRole fieldRole,
ExecutionContext ec,
boolean checkInheritance)
Convenience method to find an object given a string form of its identity, and the metadata for the member.
|
static Object |
getObjectFromPersistableIdentity(String persistableId,
AbstractClassMetaData cmd,
ExecutionContext ec)
Convenience method to find an object given a string form of its identity, and the metadata for the class (or a superclass).
|
static String |
getPersistableIdentityForId(Object id)
Method to return a persistable form of the identity of a persistable object.
|
static String |
getTargetClassNameForIdentity(Object id)
Method to return the target class name of the persistable object that the provided identity represents.
|
static Object |
getTargetKeyForDatastoreIdentity(Object id)
Accessor for the key object for the specified datastore-identity.
|
static Object |
getTargetKeyForSingleFieldIdentity(Object id)
Accessor for the key object for the specified single field application-identity.
|
static Object |
getValueForMemberInId(Object id,
AbstractMemberMetaData pkMmd)
Convenience method that interrogates a user-supplied object identity and returns the value of a particular member
in that id.
|
static boolean |
isDatastoreIdentity(Object id)
Accessor for whether the provided id is datastore identity.
|
static boolean |
isSingleFieldIdentity(Object id)
Accessor for whether the passed identity is a valid single-field application-identity for this API.
|
static boolean |
isSingleFieldIdentityClass(String className)
Checks whether the passed class name is valid for a single field application-identity.
|
public static boolean isSingleFieldIdentityClass(String className)
className
- the identity class namepublic static String getTargetClassNameForIdentity(Object id)
targetClassNamefield and returns it if present. Otherwise returns null.
id
- The identitypublic static boolean isSingleFieldIdentity(Object id)
id
- The idpublic static boolean isDatastoreIdentity(Object id)
id
- The identity to checkpublic static Object getTargetKeyForSingleFieldIdentity(Object id)
id
- The identitypublic static Object getTargetKeyForDatastoreIdentity(Object id)
id
- The identitypublic static Class getKeyTypeForSingleFieldIdentityType(Class idType)
idType
- Single field identity typepublic static String getPersistableIdentityForId(Object id)
id
- The idpublic static Object getObjectFromPersistableIdentity(String persistableId, AbstractClassMetaData cmd, ExecutionContext ec)
persistableId
- The persistable idcmd
- (Root) metadata for the classec
- Execution Contextpublic static Object getApplicationIdentityForResultSetRow(ExecutionContext ec, AbstractClassMetaData cmd, Class pcClass, boolean inheritanceCheck, FieldManager resultsFM)
ec
- Execution Contextcmd
- Metadata for the classpcClass
- The class requiredinheritanceCheck
- Whether need an inheritance check (may be for a subclass)resultsFM
- FieldManager servicing the resultspublic static Object getValueForMemberInId(Object id, AbstractMemberMetaData pkMmd)
id
- The (user-defined) identitypkMmd
- Metadata for the member that we require the value forpublic static Object getObjectFromIdString(String idStr, AbstractClassMetaData cmd, ExecutionContext ec, boolean checkInheritance)
idStr
- The id stringcmd
- Metadata for the classec
- Execution ContextcheckInheritance
- Whether to check the inheritance level of this objectpublic static Object getObjectFromIdString(String idStr, AbstractMemberMetaData mmd, FieldRole fieldRole, ExecutionContext ec, boolean checkInheritance)
idStr
- The id stringmmd
- Metadata for the memberfieldRole
- Role of this field (see org.datanucleus.metadata.FieldRole)ec
- Execution ContextcheckInheritance
- Whether to check the inheritance level of this objectCopyright © 2019. All rights reserved.