/** Get the field names for a <code>PersistenceCapable</code> class. The * order of fields is the natural ordering of the <code>String</code> class * (without considering localization). * @param pcClass the <code>PersistenceCapable</code> class. * @return the field names for the class. */ public String[] getFieldNames (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldNames(); }
/** Get the field types for a <code>PersistenceCapable</code> class. The * order of fields is the same as for field names. * @param pcClass the <code>PersistenceCapable</code> class. * @return the field types for the class. */ public Class[] getFieldTypes (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldTypes(); }
/** Get the persistence-capable superclass for a * <code>PersistenceCapable</code> class. * @param pcClass the <code>PersistenceCapable</code> class. * @return The <code>PersistenceCapable</code> superclass for this class, * or <code>null</code> if there isn't one. */ public Class getPersistenceCapableSuperclass (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getPersistenceCapableSuperclass(); }
/** Get the field flags for a <code>PersistenceCapable</code> class. The * order of fields is the same as for field names. * @param pcClass the <code>PersistenceCapable</code> class. * @return the field types for the class. */ public byte[] getFieldFlags (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldFlags(); }
/** Get the field names for a <code>PersistenceCapable</code> class. The * order of fields is the natural ordering of the <code>String</code> class * (without considering localization). * @param pcClass the <code>PersistenceCapable</code> class. * @return the field names for the class. */ public String[] getFieldNames (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldNames(); }
/** Get the field types for a <code>PersistenceCapable</code> class. The * order of fields is the same as for field names. * @param pcClass the <code>PersistenceCapable</code> class. * @return the field types for the class. */ public Class[] getFieldTypes (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldTypes(); }
/** Get the persistence-capable superclass for a * <code>PersistenceCapable</code> class. * @param pcClass the <code>PersistenceCapable</code> class. * @return The <code>PersistenceCapable</code> superclass for this class, * or <code>null</code> if there isn't one. */ public Class getPersistenceCapableSuperclass (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getPersistenceCapableSuperclass(); }
/** Get the field flags for a <code>PersistenceCapable</code> class. The * order of fields is the same as for field names. * @param pcClass the <code>PersistenceCapable</code> class. * @return the field types for the class. */ public byte[] getFieldFlags (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldFlags(); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code>. The new instance has its * <code>jdoFlags</code> set to <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code>. The new instance has its * <code>jdoFlags</code> set to <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm); }
/** Create a new instance of the ObjectId class of this * <code>PersistenceCapable</code> 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. * @param pcClass the <code>PersistenceCapable</code> class. * @return the new ObjectId instance, or <code>null</code> if the class * is not registered. */ public Object newObjectIdInstance (Class pcClass) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewObjectIdInstance(); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code> and key values from the ObjectId. If the * oid parameter is <code>null</code>, no key values are copied. * The new instance has its <code>jdoFlags</code> set to * <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm, Object oid) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. * @param oid the ObjectId instance from which to copy key field values. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm, oid); }
/** Create a new instance of the ObjectId class of this * <code>PersistenceCapable</code> 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. * @param pcClass the <code>PersistenceCapable</code> class. * @return the new ObjectId instance, or <code>null</code> if the class * is not registered. */ public Object newObjectIdInstance (Class pcClass) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewObjectIdInstance(); }
/** Create a new instance of the class and assign its * <code>jdoStateManager</code> and key values from the ObjectId. If the * oid parameter is <code>null</code>, no key values are copied. * The new instance has its <code>jdoFlags</code> set to * <code>LOAD_REQUIRED</code>. * @see PersistenceCapable#jdoNewInstance(StateManager sm, Object oid) * @param pcClass the <code>PersistenceCapable</code> class. * @param sm the <code>StateManager</code> which will own the new instance. * @return the new instance, or <code>null</code> if the class is not * registered. * @param oid the ObjectId instance from which to copy key field values. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm, oid); }
Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return (pcInstance == null)?null:pcInstance.jdoNewObjectIdInstance(obj);
Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return (pcInstance == null)?null:pcInstance.jdoNewObjectIdInstance(obj);
/** * Add the specified <code>RegisterClassListener</code> to the listener * list. * @param crl the listener to be added */ public void addRegisterClassListener (RegisterClassListener crl) { HashSet alreadyRegisteredClasses = null; synchronized (listeners) { listeners.add(crl); // Make a copy of the existing set of registered classes. // Between these two lines of code, any number of new class // registrations might occur, and will then all wait until this // synchronized block completes. Some of the class registrations // might be delivered twice to the newly registered listener. alreadyRegisteredClasses = new HashSet<Class> (registeredClasses.keySet()); } // new registrations will call the new listener while the following // occurs notify the new listener about already-registered classes for (Iterator it = alreadyRegisteredClasses.iterator(); it.hasNext();) { Class pcClass = (Class)it.next(); Meta meta = getMeta (pcClass); RegisterClassEvent event = new RegisterClassEvent( this, pcClass, meta.getFieldNames(), meta.getFieldTypes(), meta.getFieldFlags(), meta.getPersistenceCapableSuperclass()); crl.registerClass (event); } }
/** Copy fields to an outside source from the key fields in the ObjectId. * This method is generated in the <code>PersistenceCapable</code> 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 * (<code>int id</code>, <code>String name</code>, and * <code>Float salary</code>) would have the method generated: * <P><code>void jdoCopyKeyFieldsFromObjectId * <BR> (PersistenceCapable oid, ObjectIdFieldConsumer fm) { * <BR> fm.storeIntField (0, oid.id); * <BR> fm.storeStringField (1, oid.name); * <BR> fm.storeObjectField (2, oid.salary); * <BR>}</code> * <P>The implementation is responsible for implementing the * <code>ObjectIdFieldConsumer</code> to store the values for the key * fields. * @param pcClass the <code>PersistenceCapable</code> class * @param oid the ObjectId source of the copy. * @param fm the field manager that receives the field values. */ public void copyKeyFieldsFromObjectId (Class pcClass, PersistenceCapable.ObjectIdFieldConsumer fm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); if (pcInstance == null) { throw new JDOFatalInternalException (msg.msg( "ERR_AbstractClassNoIdentity", pcClass.getName())); //NOI18N } pcInstance.jdoCopyKeyFieldsFromObjectId(fm, oid); }
/** Copy fields from an outside source to the key fields in the ObjectId. * This method is generated in the <code>PersistenceCapable</code> class to * generate a call to the field manager for each key field in the ObjectId. * <P>For example, an ObjectId class that has three key fields * (<code>int id</code>, <code>String name</code>, and * <code>Float salary</code>) would have the method generated: * <P><code> * void jdoCopyKeyFieldsToObjectId (Object oid, ObjectIdFieldSupplier fm) { * <BR> oid.id = fm.fetchIntField (0); * <BR> oid.name = fm.fetchStringField (1); * <BR> oid.salary = fm.fetchObjectField (2); * <BR>}</code> * <P>The implementation is responsible for implementing the * <code>ObjectIdFieldSupplier</code> to provide the values for the key * fields. * @param pcClass the <code>PersistenceCapable Class</code>. * @param oid the ObjectId target of the copy. * @param fm the field manager that supplies the field values. */ public void copyKeyFieldsToObjectId (Class pcClass, PersistenceCapable.ObjectIdFieldSupplier fm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); if (pcInstance == null) { throw new JDOFatalInternalException (msg.msg( "ERR_AbstractClassNoIdentity", pcClass.getName())); //NOI18N } pcInstance.jdoCopyKeyFieldsToObjectId(fm, oid); }
/** Copy fields to an outside source from the key fields in the ObjectId. * This method is generated in the <code>PersistenceCapable</code> 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 * (<code>int id</code>, <code>String name</code>, and * <code>Float salary</code>) would have the method generated: * <P><code>void jdoCopyKeyFieldsFromObjectId * <BR> (PersistenceCapable oid, ObjectIdFieldConsumer fm) { * <BR> fm.storeIntField (0, oid.id); * <BR> fm.storeStringField (1, oid.name); * <BR> fm.storeObjectField (2, oid.salary); * <BR>}</code> * <P>The implementation is responsible for implementing the * <code>ObjectIdFieldConsumer</code> to store the values for the key * fields. * @param pcClass the <code>PersistenceCapable</code> class * @param oid the ObjectId source of the copy. * @param fm the field manager that receives the field values. */ public void copyKeyFieldsFromObjectId (Class pcClass, PersistenceCapable.ObjectIdFieldConsumer fm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); if (pcInstance == null) { throw new JDOFatalInternalException (msg.msg( "ERR_AbstractClassNoIdentity", pcClass.getName())); //NOI18N } pcInstance.jdoCopyKeyFieldsFromObjectId(fm, oid); }