abstractpublic class AbstractClassMetaData extends MetaData(Code)
Abstract representation of the MetaData of a class/interface.
Has a parent PackageMetaData that can contain the metadata for several classes/interfaces.
Is extended by ClassMetaData and InterfaceMetaData.
Of the things that it contains the main one are the "members" which are the MetaData for
all fields and properties that are persistable.
since: 1.1 version: $Revision: 1.98 $
AbstractClassMetaData(InterfaceMetaData imd, String implClassName, boolean copyMembers) Constructor for creating the ClassMetaData for an implementation of a "persistent-interface".
public
AbstractClassMetaData(ClassMetaData cmd, String implClassName) Constructor for creating the ClassMetaData for an implementation of a "persistent-abstract-class".
checkInitialised() Method to check whether the Meta-Data has been initialised.
throws: JDOFatalInternalException - Thrown if the Meta-Data hasn't been initialised.
protected void
checkPopulated() Method to check whether the Meta-Data has been populated.
throws: JPOXException - Thrown if the Meta-Data hasn't been populated.
getDiscriminatorMetaDataForTable() Convenience method to find the discriminator MetaData defining the discrim for the same table
as this class is using.
getMemberBeingOverridden(String name) Convenience method that navigates up a MetaData inheritance tree until it finds the base field/property definition.
public int
getMemberCount() Accessor for the number of managed fields/properties from this class plus inherited classes.
getMetaDataForManagedMemberAtAbsolutePosition(int abs_position) Accessor for a managed field/property including superclass fields.
Parameters: abs_position - The position of the managed member including thesuperclass.
getMetaDataForManagedMemberAtAbsolutePositionInternal(int abs_position) Internal method to get the field/property for an absolute field number.
If the field for that absolute field position is overridden by a field in this class
then this field/property will be returned.
Parameters: abs_position - The position of the managed field including thesuperclass.
getOverriddenMember(int position) Accessor for MetaData for an overridden field/property in this class.
Parameters: position - The position of the overridden field/property.
Managed fields/properties of this class. Contains the same AbstractMemberMetaData objects as are in "members".
Doesnt include any overridden members which are stored separately. All fields will return true to
"fmd.isJdoField()".
Constructor.
Takes the basic string information found in an XML MetaData file.
Parameters: parent - The package to which this class/interface 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: embeddedOnly - embedded-only tag Parameters: modifier - persistence-modifier tag Parameters: catalog - The catalog name default for this class Parameters: schema - The schema name default for this class Parameters: table - table to store the class in Parameters: entityName - the entity name required by JPA §4.3.1
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: copyMembers - Whether to copy the fields/properties of the interface too
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
Convenience method to copy the properties from an existing interface.
Adds FieldMetaData for each PropertyMetaData on the persistent-interface.
Parameters: imd - The interface that we copy from
Impose a default inheritance strategy when one is not already specified.
Uses the PMF property for defaultInheritanceStrategy and works to the JDO2 spec etc.
Determine the object id class
Parameters: clr - the ClassLoader throws: InvalidMetaDataException - if the class 0 or more that one primary key field and no objectid-classhas been declared in the MetaData throws: InvalidMetaDataException - if the objectid-class has not been set and the primary key field doesnot match a supported SingleFieldIdentity throws: InvalidMetaDataException - if the identity type is APPLICATION but not primary key fields have been set throws: InvalidMetaDataException - if the objectid-class cannot be loaded by the clr
Determine the super PersistenceCapable class.
The persistence-capable-superclass attribute is deprecated for JDO2.0.
The attribute will be ignored so metadata files from previous releases can be used.
The persistenceCapableSuperclass we use will be retrieved from the class itself.
Parameters: clr - The ClassLoaderResolver Parameters: cls - This class throws: InvalidMetaDataException - if the declared persistence-capable-superclass super class cannot be loaded by the clr. throws: InvalidMetaDataException - if the declared persistence-capable-superclass hasno reachable MetaData
public int getAbsoluteMemberPositionForRelativePosition(int relativePosition)(Code)
Accessor for the absolute position for a relative position.
Parameters: relativePosition - The relative field number The absolute position
getAbsolutePositionOfMember
public int getAbsolutePositionOfMember(String memberName)(Code)
Accessor for the absolute position of the field/property with the specified name.
The absolute position has origin of the root superclass, starting at 0.
Parameters: memberName - Name of the field/property Absolute position of the field/property.
getAbsolutePositionOfMember
public int getAbsolutePositionOfMember(String className, String memberName)(Code)
Accessor for the absolute position of the field/property with the specified name.
The absolute position has origin of the root superclass, starting at 0.
Will only retrieve the absolute field number if the field_name
is of type given by class_name.
Parameters: className - Name of the class Parameters: memberName - Name of the field/property Absolute position of the field/property.
Accessor for all field/property positions.
These are absolute numbers and include superclasses and are really just 0, 1, 2, ... n.
The positions of all (managed) fields/properties.
Convenience method to return the absolute positions of fields/properties that have bidirectional
relations.
Parameters: clr - ClassLoader resolver Absolute positions of bidirectional relation fields/properties
Accessor for the absolute positions of the default fetch group fields/properties (inc superclasses).
The positions of the DFG fields/properties (inc superclasses).
Convenience method to find the discriminator MetaData defining the discrim for the same table
as this class is using. Traverses up the inheritance tree to find the highest class that uses
"subclass-table" that has discriminator metadata defined, and returns the MetaData.
DiscriminatorMetaData for the highest class in this tree using subclass-table
Convenience accessor for the discriminator strategy applying to this class.
This is specified on the class managing the table if at all.
The discriminator strategy
Accessor for fetch group metadata for the specified groups (if present).
The returned metadata is what is defined for this class that matches any of the names in the input set.
Parameters: groupNames - Names of the fetch groups MetaData for the groups
Accessor for the EventListener info for an EventListener class name
Parameters: className - Name of the event listener class EventListener info for this class (or null if the class isnt an EventListener)
Accessor for the managed fields/properties in this class (not including superclass, but including overridden).
MetaData for the managed fields/properties in this class
Convenience method that navigates up a MetaData inheritance tree until it finds the base field/property definition.
Parameters: name - Name of the field/property we require The AbstractMemberMetaData
Accessor for the number of managed fields/properties from this class plus inherited classes.
The number of managed fields/properties from this class plus inherited classes.
Accessor for a managed field/property including superclass fields.
Parameters: abs_position - The position of the managed member including thesuperclass. Fields are numbered from 0 in the root superclass. The managed field/property at this "absolute" position.
Internal method to get the field/property for an absolute field number.
If the field for that absolute field position is overridden by a field in this class
then this field/property will be returned.
Parameters: abs_position - The position of the managed field including thesuperclass. Fields are numbered from 0 in the root superclass. The managed field at this "absolute" position.
Accessor for MetaData for a managed field/property in this class. The position is relative to
the first field in this class (ignores superclasses).
Parameters: position - The position of the managed field. 0 = first in the class The JDO managed field at that position
Accessor for the metadata of a field/property. Does not include superclasses
Parameters: index - field index relative to this class only starting from 0 Meta-Data for the field/property
Accessor for the number of fields/properties.
This is the total number of fields/properties (inc static, final etc) in this class
no of fields/properties.
Accessor for MetaData for an overridden field/property in this class.
Parameters: position - The position of the overridden field/property. MetaData for the field/property at that position
Accessor for the field numbers of the primary key fields/properties.
These are absolute numbers (including superclasses).
The positions of the primary key fields/properties.
Convenience accessor for the package name.
package name.
getPersistenceCapableMemberPositions
public int[] getPersistenceCapableMemberPositions()(Code)
Accessor for the absolute positions of the PersistenceCapable fields/properties.
The positions of the PersistenceCapable fields/properties (inc superclasses).
Accessor for the names of the primary key fields/properties. Only valid after being populated.
Provided as a convenience where we need to get the names of the PK members but cant wait til initialisation.
names of the PK fields/properties
Method to return the ClassMetaData records for classes referenced
by this object. This adds the entries to orderedCMDs ordered by
dependency, and to referencedCMDs for fast lookups.
Uses recursion to add all referenced ClassMetaData for any fields,
objectid classes, superclasses, and JPOX extension RDBMS "views".
This is the entry point for this process, and provides the core of the
"persistence-by-reachability" concept.
Parameters: orderedCMDs - List of ordered ClassMetaData objects (added to). Parameters: referencedCMDs - Set of all ClassMetaData objects (added to). Parameters: dba_vendor_id - Vendor ID of the DBA. Used for view addition. Parameters: clr - the ClassLoaderResolver
Convenience method to return the absolute positions of all fields/properties that have relations.
Parameters: clr - ClassLoader resolver The absolute positions of all fields/properties that have relations
getRelativePositionOfMember
public int getRelativePositionOfMember(String memberName)(Code)
Accessor for the position of the field/property with the specified name.
The returned position is relative to this class only.
Parameters: memberName - Name of the field/property Position of the field/property in this class.
getSCOContainerMemberPositions
public int[] getSCOContainerMemberPositions()(Code)
Accessor for the absolute positions of all SCO fields/properties that are containers.
Positions of all SCO container fields/properties.
Accessor for the absolute positions of the second class mutable fields/properties.
The field numbers of the second class mutable fields (inc superclasses).
getSCONonContainerMemberPositions
public int[] getSCONonContainerMemberPositions()(Code)
Accessor for the absolute positions of all SCO fields/properties that are NOT containers (e.g Dates, Points, etc)
Field numbers of all SCO non-container fields/properties
Convenience method to find the version MetaData defining versioning for the same table
as this class is using. Traverses up the inheritance tree to find the highest class that uses
"subclass-table" that has version metadata defined, and returns the MetaData.
Version MetaData for the highest class in this tree using subclass-table
Convenience method to return if the class has relations to other objects. Includes superclasses.
Whether the class has any relations (that it knows about)
Inherit the identity definition from super classes.
throws: InvalidMetaDataException - if the MetaData of this class conflicts with super classes definition
Method to initialise the sub-objects of this class metadata.
If populate() is going to be used it should be used BEFORE calling this method.
Subclasses must overwrite this method and invoke this
Whether default listeners are not going to be invoked
true if default listeners are not invoked
isExcludeSuperClassListeners
public boolean isExcludeSuperClassListeners()(Code)
Whether super classes listeners are not going to be invoked
true if super class listeners are not invoked
isImplementationOfPersistentDefinition
public boolean isImplementationOfPersistentDefinition()(Code)
Return whether this MetaData is for an implementation of a persistent definition.
This could be an implementation of a persistent interface or a persistent abstract-class.
Whether this is an implementation
Accessor for whether this class is fully specified by this metadata and that any
annotations should be ignored.
Whether we should ignore any annotations
Check if the argument cmd is the same as this or a descedent.
Parameters: cmd - the AbstractClassMetaData to be verify if this is an ancestor true if the argument is a child or same as this
Utility to add a defaulted PropertyMetaData to the class.
Provided as a method since then any derived classes can override it.
Parameters: name - name of property the new PropertyMetaData
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.
This method must be invoked by subclasses during populate operations
Parameters: clr - ClassLoaderResolver to use in loading any classes Parameters: primary - the primary ClassLoader to use (or null)
setCatalog
final public void setCatalog(String catalog)(Code)
Mutator for the catalog name.
Parameters: catalog - Name of the catalog
Cinvenience method for updating the identity type when not set correctly during construction.
This is needed where we have annotations and the user hasnt defined "APPLICATION", and we find a field
defined as @PrimaryKey so we set it to APPLICATION at that point.
Parameters: type - The Identity type to use
Check for conflicts on super class and this class MetaData identity
throws: InvalidMetaDataException - if the user tries to overwrite a super class identity / strategy
Check if the inheritance MetaData is credible.
throws: InvalidMetaDataException - if the strategy is superclass-table, yet there are no super class throws: InvalidMetaDataException - if the strategy is superclass-table, yet the super class has notspecified a discriminator throws: InvalidMetaDataException - if the strategy is superclass-table and discriminator is "value-map",yet no value for the discriminator has been specified