Class IdentityManagerImpl

  • All Implemented Interfaces:
    IdentityManager

    public class IdentityManagerImpl
    extends java.lang.Object
    implements IdentityManager
    Manager for identity operations.
    • Field Detail

      • CTR_CLASS_OBJECT_ARG_TYPES

        private static final java.lang.Class[] CTR_CLASS_OBJECT_ARG_TYPES
      • CTR_CLASS_STRING_ARG_TYPES

        private static final java.lang.Class[] CTR_CLASS_STRING_ARG_TYPES
      • CTR_STRING_OBJECT_ARG_TYPES

        private static final java.lang.Class[] CTR_STRING_OBJECT_ARG_TYPES
      • CTR_STRING_ARG_TYPES

        private static final java.lang.Class[] CTR_STRING_ARG_TYPES
      • CTR_LONG_ARG_TYPES

        private static final java.lang.Class[] CTR_LONG_ARG_TYPES
      • datastoreIdClass

        protected java.lang.Class<? extends DatastoreId> datastoreIdClass
        Default DatastoreId implementation used by DataNucleus.
      • constructorCache

        private java.util.Map<java.lang.String,​java.lang.reflect.Constructor<?>> constructorCache
        Cache of id class Constructor, keyed by string of the type+args.
    • Method Detail

      • getConstructorNameForCache

        protected java.lang.String getConstructorNameForCache​(java.lang.Class type,
                                                              java.lang.Class[] ctrArgTypes)
      • getDatastoreId

        public DatastoreId getDatastoreId​(java.lang.String className,
                                          java.lang.Object value)
        Description copied from interface: IdentityManager
        Method to return a datastore identity, representing the persistable object with specified class name and key value.
        Specified by:
        getDatastoreId in interface IdentityManager
        Parameters:
        className - The class name for the persistable
        value - The key value for the persistable
        Returns:
        The datastore id
      • getDatastoreId

        public DatastoreId getDatastoreId​(long value)
        Description copied from interface: IdentityManager
        Method to return a datastore-unique datastore identity, with the specified value.
        Specified by:
        getDatastoreId in interface IdentityManager
        Parameters:
        value - The long value that is unique across the datastore.
        Returns:
        The datastore id
      • getDatastoreId

        public DatastoreId getDatastoreId​(java.lang.String idString)
        Description copied from interface: IdentityManager
        Method to return a datastore identity, for the specified string which comes from the output of toString().
        Specified by:
        getDatastoreId in interface IdentityManager
        Parameters:
        idString - The toString() value
        Returns:
        The datastore id
      • getSingleFieldId

        public SingleFieldId getSingleFieldId​(java.lang.Class idType,
                                              java.lang.Class pcType,
                                              java.lang.Object key)
        Description copied from interface: IdentityManager
        Method to return a single-field identity, for the persistable type specified, and for the idType of SingleFieldId.
        Specified by:
        getSingleFieldId in interface IdentityManager
        Parameters:
        idType - Type of the id
        pcType - Type of the Persistable
        key - The value for the identity (the Long, or Int, or ... etc).
        Returns:
        Single field identity
      • getApplicationId

        public java.lang.Object getApplicationId​(ClassLoaderResolver clr,
                                                 AbstractClassMetaData acmd,
                                                 java.lang.String keyToString)
        Description copied from interface: IdentityManager
        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:
        getApplicationId in interface IdentityManager
        Parameters:
        clr - ClassLoader resolver
        acmd - MetaData for the target class
        keyToString - String form of the key
        Returns:
        The identity
      • getApplicationId

        public java.lang.Object getApplicationId​(java.lang.Object pc,
                                                 AbstractClassMetaData cmd)
        Description copied from interface: IdentityManager
        Method to create a new object identity for the passed object with the supplied MetaData. Only applies to application-identity cases.
        Specified by:
        getApplicationId in interface IdentityManager
        Parameters:
        pc - The persistable object
        cmd - Its metadata
        Returns:
        The new identity object
      • getApplicationId

        public java.lang.Object getApplicationId​(java.lang.Class cls,
                                                 java.lang.Object key)
        Description copied from interface: IdentityManager
        Method to return a new object identity for the specified class, and key (possibly toString() output).
        Specified by:
        getApplicationId in interface IdentityManager
        Parameters:
        cls - Persistable class
        key - form of the object id
        Returns:
        The object identity