javax.jdo.spi.JDOImplHelper - JDO class
javax.jdo.spi
Class 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
- Parameters:
-
sm
- an instance of StateManager whose class is to be checked.
- Since:
- JDO 1.0.1
- Parameters:
-
smClass
- a Class to be checked for JDOPermission("setStateManager")
- Since:
- JDO 1.0.1
- Parameters:
-
className
- the name of the classkeyString
- the String parameter for the constructor
- Returns:
- the result of construction
- Since:
- JDO 1.0
JDOImplHelper
. This method checks that the caller is authorized for JDOPermission("getMetadata")
, and if not, throws SecurityException
. - Returns:
- an instance of
JDOImplHelper
.
- Throws:
-
SecurityException
- if the caller is not authorized for JDOPermission("getMetadata").
- Since:
- JDO 1.0
- Returns:
- the DocumentBuilderFactory if registered; null otherwise
- Since:
- JDO 2.1
- Returns:
- the registered ErrorHandler if registered; null otherwise
- Since:
- JDO 2.1
- Parameters:
-
smClass
- a Class that is authorized for JDOPermission("setStateManager").
- Throws:
-
SecurityException
- if the caller is not authorized for JDOPermission("setStateManager").
- Since:
- JDO 1.0.1
- Parameters:
-
smClasses
- a Collection of Classes that are authorized for JDOPermission("setStateManager").
- Throws:
-
SecurityException
- if the caller is not authorized for JDOPermission("setStateManager").
- Since:
- JDO 1.0.1
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 fieldspersistenceCapableSuperclass
- the most immediate superclass that isPersistenceCapable
pc
- an instance of thePersistenceCapable
class
- Since:
- JDO 1.0
RegisterClassListener
to the listener list. - 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
classfm
- the field manager that receives the field values.oid
- the ObjectId source of the copy.
- 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
.fm
- the field manager that supplies the field values.oid
- the ObjectId target of the copy.
- Since:
- JDO 1.0
PersistenceCapable
class. The order of fields is the same as for field names. - Parameters:
-
pcClass
- thePersistenceCapable
class.
- Returns:
- the field types for the class.
- Since:
- JDO 1.0
PersistenceCapable
class. The order of fields is the natural ordering of the String
class (without considering localization). - Parameters:
-
pcClass
- thePersistenceCapable
class.
- Returns:
- the field names for the class.
- Since:
- JDO 1.0
PersistenceCapable
class. The order of fields is the same as for field names. - Parameters:
-
pcClass
- thePersistenceCapable
class.
- Returns:
- the field types for the class.
- Since:
- JDO 1.0
PersistenceCapable
class. - Parameters:
-
pcClass
- thePersistenceCapable
class.
- Returns:
- The
PersistenceCapable
superclass for this class, ornull
if there isn't one.
- Since:
- JDO 1.0
- Returns:
- registered persistence-capable classes
- Since:
- JDO 1.0
jdoStateManager
. The new instance has its jdoFlags
set to LOAD_REQUIRED
. - Parameters:
-
pcClass
- thePersistenceCapable
class.sm
- theStateManager
which will own the new instance.
- Returns:
- the new instance, or
null
if the class is not registered.
- Since:
- JDO 1.0
jdoStateManager
and key values from the ObjectId. If the oid parameter is 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.
- Returns:
- the new instance, or
null
if the class is not registered.
- Since:
- JDO 1.0
PersistenceCapable
class. It is intended only for application identity. This method should not be called for classes that use single field identity; newObjectIdInstance(Class, Object) should be used instead. If the class has been enhanced for datastore identity, or if the class is abstract, null is returned. - Parameters:
-
pcClass
- thePersistenceCapable
class.
- Returns:
- 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:
-
pcClass
- thePersistenceCapable
class.obj
- theObject
form of the object id
- Returns:
- 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
- Returns:
- 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
- Returns:
- 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
- Returns:
- the previous StringConstructor registered for this class
- Since:
- JDO 1.0
RegisterClassListener
from the listener list. - 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.2
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.2