Package org.apache.openjpa.enhance
Class PCRegistry
java.lang.Object
org.apache.openjpa.enhance.PCRegistry
Tracks registered persistence-capable classes.
- Since:
- 0.4.0
- Author:
- Abe White
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Listener for persistent class registration events. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Register aPCRegistry.RegisterClassListener
.static void
copyKeyFieldsFromObjectId
(Class<?> pcClass, FieldConsumer fm, Object oid) Copy fields to an outside source from the key fields in the identity object.static void
copyKeyFieldsToObjectId
(Class<?> pcClass, FieldSupplier fm, Object oid) Copy fields from an outside source to the key fields in the identity object.static void
De-Register all metadata associated with the given ClassLoader.static String[]
getFieldNames
(Class<?> pcClass) Get the field names for aPersistenceCapable
class.static Class<?>[]
getFieldTypes
(Class<?> pcClass) Get the field types for aPersistenceCapable
class.static Class<?>
Return the persistence-capable type fortype
.static Class<?>
getPersistentSuperclass
(Class<?> pcClass) Return the persistent superclass for aPersistenceCapable
class, or null if none.static Collection<Class<?>>
Returns a collection of class objects of the registered persistence-capable classes.static String
getTypeAlias
(Class<?> pcClass) Return the alias for the given type.static boolean
isRegistered
(Class<?> cls) Returnstrue
if the given class is already registered.static PersistenceCapable
newInstance
(Class<?> pcClass, StateManager sm, boolean clear) Create a new instance of the class and assign its state manager.static PersistenceCapable
newInstance
(Class<?> pcClass, StateManager sm, Object oid, boolean clear) Create a new instance of the class and assign its state manager and oid.static Object
newObjectId
(Class<?> pcClass) Create a new identity object for the givenPersistenceCapable
class.static Object
newObjectId
(Class<?> pcClass, String str) Create a new identity object for the givenPersistenceCapable
class, using theString
form of the constructor.static void
register
(Class<?> pcClass, String[] fieldNames, Class<?>[] fieldTypes, byte[] fieldFlags, Class<?> sup, String alias, PersistenceCapable pc) Register metadata by class.static boolean
Removes aPCRegistry.RegisterClassListener
.
-
Constructor Details
-
PCRegistry
public PCRegistry()
-
-
Method Details
-
addRegisterClassListener
Register aPCRegistry.RegisterClassListener
. -
removeRegisterClassListener
Removes aPCRegistry.RegisterClassListener
. -
getFieldNames
Get the field names for aPersistenceCapable
class. -
getFieldTypes
Get the field types for aPersistenceCapable
class. -
getPersistentSuperclass
Return the persistent superclass for aPersistenceCapable
class, or null if none. The superclass may or may not implementPersistenceCapable
, depending on the access type of the class. -
newInstance
Create a new instance of the class and assign its state manager. The new instance has its flags set toLOAD_REQUIRED
. -
newInstance
public static PersistenceCapable newInstance(Class<?> pcClass, StateManager sm, Object oid, boolean clear) Create a new instance of the class and assign its state manager and oid. The new instance has its flags set toLOAD_REQUIRED
. -
getPCType
Return the persistence-capable type fortype
. This might be a generated subclass oftype
.- Since:
- 1.1.0
-
newObjectId
Create a new identity object for the givenPersistenceCapable
class. -
newObjectId
Create a new identity object for the givenPersistenceCapable
class, using theString
form of the constructor. -
getTypeAlias
Return the alias for the given type. -
copyKeyFieldsToObjectId
Copy fields from an outside source to the key fields in the identity object. -
copyKeyFieldsFromObjectId
Copy fields to an outside source from the key fields in the identity object. -
register
public static void register(Class<?> pcClass, String[] fieldNames, Class<?>[] fieldTypes, byte[] fieldFlags, Class<?> sup, String alias, PersistenceCapable pc) Register metadata by class.- Parameters:
fieldTypes
- managed field typesfieldFlags
- managed field flagssup
- the most immediate persistent superclasspcClass
- thePersistenceCapable
classfieldNames
- managed field namesalias
- the class aliaspc
- an instance of the class, if not abstract
-
deRegister
De-Register all metadata associated with the given ClassLoader. Allows ClassLoaders to be garbage collected.- Parameters:
cl
- the ClassLoader
-
getRegisteredTypes
Returns a collection of class objects of the registered persistence-capable classes. -
isRegistered
Returnstrue
if the given class is already registered.
-