|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.jdo.JDOImplHelper
This class is a helper class for JDO implementations. It contains methods to register metadata for persistence-capable classes and to perform common operations needed by implementations, not by end users.
JDOImplHelper allows construction of instances of persistence-capable classes without using reflection.
Persistence-capable classes register themselves via a static method at class load time. There is no security restriction on this access. JDO implementations get access to the functions provided by this class only if they are authorized by the security manager. To avoid having every call go through the security manager, only the call to get an instance is checked. Once an implementation has an instance, any of the methods can be invoked without security checks.
Nested Class Summary | |
(package private) static class |
JDOImplHelper.Meta
This is a helper class to manage metadata per persistence-capable class. |
Method Summary | |
void |
copyKeyFieldsToObjectId(java.lang.Class pcClass,
PersistenceCapable.ObjectIdFieldManager fm,
java.lang.Object oid)
Copy fields from an outside source to the key fields in the ObjectId. |
void |
copyKeyFieldsToObjectId(PersistenceCapable pc,
java.lang.Object oid)
Copy fields from the PersistenceCapable instance to the Object Id instance. |
byte[] |
getFieldFlags(java.lang.Class pcClass)
Get the field flags for a PersistenceCapable class. |
java.lang.String[] |
getFieldNames(java.lang.Class pcClass)
Get the field names for a PersistenceCapable class. |
java.lang.Class[] |
getFieldTypes(java.lang.Class pcClass)
Get the field types for a PersistenceCapable class. |
static JDOImplHelper |
getInstance()
Get an instance of JDOImplHelper. |
java.lang.Class |
getPersistenceCapableSuperclass(java.lang.Class pcClass)
Get the persistence-capable superclass for a PersistenceCapable class. |
PersistenceCapable |
newInstance(java.lang.Class pcClass,
StateManager sm)
Create a new instance of the class and assign its jdoStateManager. |
PersistenceCapable |
newInstance(java.lang.Class pcClass,
StateManager sm,
java.lang.Object oid)
Create a new instance of the class and assign its jdoStateManager and key values from the ObjectId. |
java.lang.Object |
newObjectIdInstance(java.lang.Class pcClass)
Create a new instance of the ObjectId class of this PersistenceCapable class. |
static void |
registerClass(java.lang.Class pcClass,
java.lang.String[] fieldNames,
java.lang.Class[] fieldTypes,
byte[] fieldFlags,
java.lang.Class persistenceCapableSuperclass,
PersistenceCapable pc)
Register metadata by class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static JDOImplHelper getInstance() throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public java.lang.String[] getFieldNames(java.lang.Class pcClass)
pcClass
- the PersistenceCapable class.
public java.lang.Class[] getFieldTypes(java.lang.Class pcClass)
pcClass
- the PersistenceCapable class.
public byte[] getFieldFlags(java.lang.Class pcClass)
pcClass
- the PersistenceCapable class.
public java.lang.Class getPersistenceCapableSuperclass(java.lang.Class pcClass)
pcClass
- the PersistenceCapable class.
public PersistenceCapable newInstance(java.lang.Class pcClass, StateManager sm)
pcClass
- the PersistenceCapable class.sm
- the StateManager which will own the new instance.
PersistenceCapable.jdoNewInstance(StateManager sm)
public PersistenceCapable newInstance(java.lang.Class pcClass, StateManager sm, java.lang.Object oid)
pcClass
- the PersistenceCapable class.sm
- the StateManager which will own the new instance.oid
- the ObjectId instance from which to copy key field values.
PersistenceCapable.jdoNewInstance(StateManager sm, Object oid)
public java.lang.Object newObjectIdInstance(java.lang.Class pcClass)
pcClass
- the PersistenceCapable class.
public void copyKeyFieldsToObjectId(java.lang.Class pcClass, PersistenceCapable.ObjectIdFieldManager fm, java.lang.Object oid)
For example, an ObjectId class that has three key fields (int id, String name, and Float salary) would have the method generated:
void copyKeyFieldsToObjectId (Object oid, ObjectIdFieldManager fm) {
oid.id = fm.fetchIntField (0);
oid.name = fm.fetchStringField (1);
oid.salary = fm.fetchObjectField (2);
}
The implementation is responsible for implementing the ObjectIdFieldManager to produce the values for the key fields.
pcClass
- the PersistenceCapable Class.oid
- the ObjectId target of the copy.fm
- the field manager that supplies the field values.public void copyKeyFieldsToObjectId(PersistenceCapable pc, java.lang.Object oid)
pc
- the PersistenceCapable source of the key fieldsoid
- the ObjectId target of the key fieldspublic static void registerClass(java.lang.Class pcClass, java.lang.String[] fieldNames, java.lang.Class[] fieldTypes, byte[] fieldFlags, java.lang.Class persistenceCapableSuperclass, PersistenceCapable pc)
pcClass
- the PersistenceCapable class
used as the key for lookup.fieldNames
- an array of String field names.fieldTypes
- an array of Class field typespc
- the PersistenceCapable class.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |