| java.lang.Object org.jpox.metadata.MetaData org.jpox.metadata.AbstractClassMetaData org.jpox.metadata.ClassMetaData
ClassMetaData | public class ClassMetaData extends AbstractClassMetaData (Code) | | Representation of the MetaData of a class. Extends the abstract definition to include
implementations, fields, embedded-only tags. Has a parent PackageMetaData that
can contain the metadata for several classes.
Lifecycle state
This object supports 3 lifecycle states. The first is the raw
constructed object which represents pure MetaData (maybe from a MetaData
file). The second is a "populated" object which represents MetaData for a
Class with the metadata aligned to be appropriate for that Class.
The third is "initialised" once the internal arrays are created.
This object, once populated, will represent ALL fields in the class
(including static, final and transient fields).
Fields/Properties
This object keeps a list of FieldMetaData/PropertyMetaData objects for the fields of this class.
In addition it has an array of FieldMetaData
objects representing those that are actually managed by JDO
("managedFields"). This second set does not contain things like static, final
or transient fields since JDO doesn't support those yet.
Fields are of 2 types. The first are normal fields of this class.
These have their own "relative" field number, relative to this class.
The second type are "overriding" fields which override the baseline field
in a superclass. These fields have no "relative" field number since they are
relative to this class (and such a relative field number would make no sense).
Fields are all added through addField() during the parse process, and
are updated during the populate/initialise process to define their relative field
numbers. Please refer to FieldMetaData for more details of fields.
Numbering of fields
Fields of the class are numbered in 2 ways. The first way is the numbering
within a class. In a class, the field 'id's will start at 0. If a class is
inherited, it will also have a second numbering for its fields - the
"absolute" numbering. With "absolute" numbering, the fields start at the
first field in the root superclass which has absolute number 0, and they are
numbered from there, navigating down the hierarchy. In terms of what is
stored in the records, the FieldMetaData stores fieldId as the first
method (relative to the class it is in). The "absolute" numbering is
always derived from this and the inheritance hierarchy.
MetaData Element
The MetaData Element represented here is as follows
<!ELEMENT class (datastore-identity?, implements*, inheritance?, version?, join*,
foreign-key*, index*, unique*, field*, column*, query*, fetch-group*, extension*)>
<!ATTLIST class name CDATA #REQUIRED>
<!ATTLIST class identity-type (application|datastore|nondurable) #IMPLIED>
<!ATTLIST class catalog CDATA #IMPLIED>
<!ATTLIST class schema CDATA #IMPLIED>
<!ATTLIST class table CDATA #IMPLIED>
<!ATTLIST class persistence-capable-superclass CDATA #IMPLIED>
<!ATTLIST class objectid-class CDATA #IMPLIED>
<!ATTLIST class requires-extent (true|false) 'true'>
<!ATTLIST class detachable (true|false) 'true'>
<!ATTLIST class embedded-only (true|false) #IMPLIED>
<!ATTLIST class persistence-modifier
(persistence-capable|persistence-aware|non-persistent) #IMPLIED>
since: 1.1 version: $Revision: 1.136 $ |
Constructor Summary | |
public | ClassMetaData(PackageMetaData parent, String name, String identityType, String objectidClass, String requiresExtent, String detachable, String embeddedOnly, String modifier, String persistenceCapableSuperclass, String catalog, String schema, String table, String entityName) Constructor. | public | ClassMetaData(InterfaceMetaData imd, String implClassName, boolean copyFields) Constructor for creating the ClassMetaData for an implementation of a "persistent-interface". | public | ClassMetaData(ClassMetaData cmd, String implClassName) Constructor for creating the ClassMetaData for an implementation of a "persistent-abstract-class". |
implementations | protected List implementations(Code) | | List of implements.
|
isAbstractPersistenceCapable | protected boolean isAbstractPersistenceCapable(Code) | | is the persistable class abstract.
|
ClassMetaData | public ClassMetaData(PackageMetaData parent, String name, String identityType, String objectidClass, String requiresExtent, String detachable, String embeddedOnly, String modifier, String persistenceCapableSuperclass, String catalog, String schema, String table, String entityName)(Code) | | Constructor.
Takes the basic string information found in the MetaData file.
Parameters: parent - The package to which this class belongs Parameters: name - Name of class Parameters: identityType - identity-type flag Parameters: objectidClass - Primary key class name Parameters: requiresExtent - Whether the class requires an extent Parameters: detachable - Whether the class can be detached Parameters: modifier - persistence-modifier tag Parameters: embeddedOnly - embedded-only tag Parameters: persistenceCapableSuperclass - Name of PC superclass Parameters: catalog - Name for catalog Parameters: schema - Name for schema Parameters: table - RDBMS table to store the class in Parameters: entityName - the entity name required by JPA §4.3.1 |
ClassMetaData | public ClassMetaData(InterfaceMetaData imd, String implClassName, boolean copyFields)(Code) | | Constructor for creating the ClassMetaData for an implementation of a "persistent-interface".
Parameters: imd - MetaData for the "persistent-interface" Parameters: implClassName - Name of the implementation class Parameters: copyFields - Whether to copy the fields of the interface too |
ClassMetaData | public ClassMetaData(ClassMetaData cmd, String implClassName)(Code) | | Constructor for creating the ClassMetaData for an implementation of a "persistent-abstract-class".
Parameters: cmd - MetaData for the implementation of the "persistent-abstract-class" Parameters: implClassName - Name of the implementation class |
addImplements | public void addImplements(ImplementsMetaData implmd)(Code) | | Method to add an implements to this class.
Parameters: implmd - Meta-Data for the implements |
addMetaDataForMembersNotInMetaData | protected void addMetaDataForMembersNotInMetaData(Class cls)(Code) | | Add MetaData of fields/properties not declared in MetaData.
Parameters: cls - Class represented by this metadata |
getImplementsMetaData | final public ImplementsMetaData[] getImplementsMetaData()(Code) | | Accessor for the implements MetaData
Returns the implements MetaData. |
implementsInterface | public boolean implementsInterface(String interfaceName)(Code) | | Convenience accessor for whether this class implements a specified interface
Parameters: interfaceName - The name of the interface Whether it implements the interface |
initialise | public synchronized void initialise()(Code) | | Method to initialise the object, creating internal convenience arrays.
Initialises all sub-objects. populate() should be called BEFORE calling this.
|
isAbstractPersistenceCapable | public boolean isAbstractPersistenceCapable()(Code) | | Whether the PersistenceCapable class is abstract
true if the PersistenceCapable class is abstract |
newDefaultedProperty | protected AbstractMemberMetaData newDefaultedProperty(String name)(Code) | | Utility to add a defaulted FieldMetaData to the class. Provided as a
method since then any derived classes can override it (e.g
JDOConfigClass can create a JDOConfigField)
Parameters: name - name of field the new FieldMetaData |
populate | public synchronized void populate(ClassLoaderResolver clr, ClassLoader primary)(Code) | | Method to provide the details of the class being represented by this
MetaData. This can be used to firstly provide defaults for attributes
that aren't specified in the MetaData, and secondly to report any errors
with attributes that have been specifed that are inconsistent with the
class being represented.
One possible use of this method would be to take a basic ClassMetaData
for a class and call this, passing in the users class. This would then
add FieldMetaData for all fields in this class providing defaults for
all of these.
Parameters: clr - ClassLoaderResolver to use in loading any classes Parameters: primary - the primary ClassLoader to use (or null) |
populateMemberMetaData | protected void populateMemberMetaData(ClassLoaderResolver clr, Class cls, boolean pkMembers, ClassLoader primary)(Code) | | Populate MetaData for all members.
Parameters: clr - The ClassLoaderResolver Parameters: cls - This class Parameters: pkMembers - Process pk fields/properties (or non-PK if false) Parameters: primary - the primary ClassLoader to use (or null) throws: InvalidMetaDataException - if the Class for a declared type in a field cannot be loaded by the clr throws: InvalidMetaDataException - if a field declared in the MetaData does not exist in the Class |
toString | public String toString(String prefix, String indent)(Code) | | Returns a string representation of the object.
This can be used as part of a facility to output a MetaData file.
Parameters: prefix - prefix string Parameters: indent - indent string a string representation of the object. |
|
|