JDOImplHelper
java.lang.Object
∟ javax.jdo.spi.JDOImplHelper
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.
- Since:
- JDO 1.0
Public Methods
- Parameters:
crl
- the listener to be added
- Since:
- JDO 1.0
- Parameters:
si
- the StateInterrogation to add
- Since:
- JDO 1.0
PersistenceCapable
class to generate a call to the field manager for each key field in the ObjectId. For example, an ObjectId class that has three key fields (int id
, String name
, and Float salary
) would have the method generated: void jdoCopyKeyFieldsFromObjectId
(PersistenceCapable oid, ObjectIdFieldConsumer fm) {
fm.storeIntField (0, oid.id);
fm.storeStringField (1, oid.name);
fm.storeObjectField (2, oid.salary);
}
The implementation is responsible for implementing the ObjectIdFieldConsumer
to store the values for the key fields.
- Parameters:
pcClass
- thePersistenceCapable
classoid
- the ObjectId source of the copy.fm
- the field manager that receives the field values.
- Since:
- JDO 1.0
PersistenceCapable
class to generate a call to the field manager for each key field in the ObjectId. For example, an ObjectId class that has three key fields (int id
, String name
, and Float salary
) would have the method generated:
void jdoCopyKeyFieldsToObjectId (Object oid, ObjectIdFieldSupplier fm) {
oid.id = fm.fetchIntField (0);
oid.name = fm.fetchStringField (1);
oid.salary = fm.fetchObjectField (2);
}
The implementation is responsible for implementing the ObjectIdFieldSupplier
to provide the values for the key fields.
- Parameters:
pcClass
- thePersistenceCapable Class
.oid
- the ObjectId target of the copy.fm
- the field manager that supplies the field values.
- Since:
- JDO 1.0
- Parameters:
pcClass
- thePersistenceCapable
class.
- Return:
- the field types for the class.
- Since:
- JDO 1.0
String
class (without considering localization). - Parameters:
pcClass
- thePersistenceCapable
class.
- Return:
- the field names for the class.
- Since:
- JDO 1.0
- Parameters:
pcClass
- thePersistenceCapable
class.
- Return:
- the field types for the class.
- Since:
- JDO 1.0
- Parameters:
pcClass
- thePersistenceCapable
class.
- Return:
- The
PersistenceCapable
superclass for this class, ornull
if there isn't one.
- Since:
- JDO 1.0
- Return:
- registered persistence-capable classes
- Since:
- JDO 1.0
jdoFlags
set to LOAD_REQUIRED
. - Parameters:
pcClass
- thePersistenceCapable
class.sm
- theStateManager
which will own the new instance.
- Return:
- the new instance, or
null
if the class is not registered.
- See Also:
PersistenceCapable(StateManager sm)
- Since:
- JDO 1.0
null
, no key values are copied. The new instance has its jdoFlags
set to LOAD_REQUIRED
. - Parameters:
pcClass
- thePersistenceCapable
class.sm
- theStateManager
which will own the new instance.oid
- the ObjectId instance from which to copy key field values.
- Return:
- the new instance, or
null
if the class is not registered.
- See Also:
PersistenceCapable(StateManager sm,Object oid)
- Since:
- JDO 1.0
- Parameters:
pcClass
- thePersistenceCapable
class.
- Return:
- the new ObjectId instance, or
null
if the class is not registered.
- Since:
- JDO 1.0
For classes that use single field identity, if the parameter is of one of the following types, the behavior must be as specified:
Number
orCharacter
: the parameter must be the single field type or the wrapper class of the primitive field type; the parameter is passed to the single field identity constructorObjectIdFieldSupplier
: the field value is fetched from theObjectIdFieldSupplier
and passed to the single field identity constructorString
: the String is passed to the single field identity constructor
- Parameters:
obj
- theObject
form of the object idpcClass
- thePersistenceCapable
class.
- Return:
- the new ObjectId instance, or
null
if the class is not registered.
- Since:
- JDO 2.0
- Parameters:
pc
- the instance whose associated object is neededsibr
- the method object that delegates to the non-binary-compatible implementation
- Return:
- the associated object or null if the implementation does not manage the class of the instance
- Since:
- JDO 1.0
- Parameters:
pc
- the instance to be checkedsibr
- the method object that delegates to the non-binary-compatible implementation
- Return:
- Boolean.TRUE if the instance satisfies the state interrogation; Boolean.FALSE if the instance does not satisfy the interrogation; or null if the implementation does not manage the class of the instance
- Since:
- JDO 1.0
- Parameters:
pc
- the instance to mark dirtyfieldName
- the field to mark dirty
- Since:
- JDO 1.0
- Parameters:
df
- the DateFormat instance to use
- Since:
- JDO 2.0
- Parameters:
factory
- the DocumentBuilderFactory instance to use
- Since:
- JDO 2.1
- Parameters:
handler
- the ErrorHandler instance to use
- Since:
- JDO 2.1
- Parameters:
cls
- the class to register a StringConstructor forsc
- the StringConstructor instance
- Return:
- the previous StringConstructor registered for this class
- Since:
- JDO 1.0
- Parameters:
crl
- the listener to be removed
- Since:
- JDO 1.0
- Parameters:
si
- the StateInterrogation to remove
- Since:
- JDO 1.0
JDOFatalUserException
. - Parameters:
pcClass
- thePersistenceCapable
class to be unregistered.
- Since:
- JDO 1.0
PersistenceCapable
classes loaded by the specified class loader. Any attempt to get metadata for unregistered classes will result in a JDOFatalUserException
. - Parameters:
cl
- the class loader.
- Since:
- JDO 1.0
Public Static Methods
- Parameters:
sm
- an instance of StateManager whose class is to be checked.
- Since:
- JDO 1.0
- Parameters:
smClass
- a Class to be checked for JDOPermission("setStateManager")
- Since:
- JDO 1.0
- Parameters:
className
- the name of the classkeyString
- the String parameter for the constructor
- Return:
- the result of construction
- Since:
- JDO 1.0
JDOPermission("getMetadata")
, and if not, throws SecurityException
. - Return:
- an instance of
JDOImplHelper
.
- Throws:
- SecurityExceptionif the caller is not authorized for JDOPermission("getMetadata").
- Since:
- JDO 1.0
- Return:
- the DocumentBuilderFactory if registered; null otherwise
- Since:
- JDO 2.1
- Return:
- the registered ErrorHandler if registered; null otherwise
- Since:
- JDO 2.1
- Parameters:
smClass
- a Class that is authorized for JDOPermission("setStateManager").
- Throws:
- SecurityExceptionif the caller is not authorized for JDOPermission("setStateManager").
- Since:
- JDO 1.0
- Parameters:
smClasses
- a Collection of Classes that are authorized for JDOPermission("setStateManager").
- Throws:
- SecurityExceptionif the caller is not authorized for JDOPermission("setStateManager").
- Since:
- JDO 1.0
JDOImplHelper
loaded by the same or an ancestor class loader as the PersistenceCapable
class performing the registration. - Parameters:
pcClass
- thePersistenceCapable
class used as the key for lookup.fieldNames
- an array ofString
field names for persistent and transactional fieldsfieldTypes
- an array ofClass
field typesfieldFlags
- the Field Flags for persistent and transactional fieldspc
- an instance of thePersistenceCapable
classpersistenceCapableSuperclass
- the most immediate superclass that isPersistenceCapable
- Since:
- JDO 1.0