Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.impl.model.jdo » [javadoc | source]
org.apache.jdo.impl.model.jdo
public class: JDOClassImplDynamic [javadoc | source]
java.lang.Object
   org.apache.jdo.impl.model.jdo.JDOElementImpl
      org.apache.jdo.impl.model.jdo.JDOMemberImpl
         org.apache.jdo.impl.model.jdo.JDOClassImplDynamic

All Implemented Interfaces:
    JDOClass, JDOMember, JDOElement

Direct Known Subclasses:
    JDOClassImplCaching

An instance of this class represents the JDO metadata of a persistence capable class. This dynamic implementation only stores property values explicitly set by setter method. It does not store any calculated values such as list of managed or persistent fields, list of field numbers etc.

TBD:

Field Summary
protected  String shortName    Property shortName. It defaults to the unqualified class name. 
protected  int identityType    Property identityType. Default see #getIdentityType
protected transient  JavaType objectIdClass    Property objectIdClass. No default. 
protected  JDOClass pcSuperclass    Relationship JDOClass<->JDOClass. 
protected transient  JavaType javaType    Property javaType. No default. 
protected static final  I18NHelper msg    I18N support 
Constructor:
 protected JDOClassImplDynamic(String name) 
    Constructor.
 protected JDOClassImplDynamic(String name,
    JDOClass declaringClass) 
    Constructor for inner classes.
Method from org.apache.jdo.impl.model.jdo.JDOClassImplDynamic Summary:
createJDOClass,   createJDOField,   createJDOProperty,   createJDOProperty,   getAssociatedProperty,   getAssociatedProperty,   getDeclaredClasses,   getDeclaredField,   getDeclaredFields,   getDeclaredManagedFieldCount,   getDeclaredManagedFields,   getDeclaredMembers,   getDeclaredObjectIdClassName,   getDeclaredPrimaryKeyFields,   getDeclaringModel,   getDefaultFetchGroupFields,   getField,   getField,   getFieldInternal,   getIdentityType,   getInheritedManagedFieldCount,   getJDOPackage,   getJavaType,   getManagedField,   getManagedFieldCount,   getManagedFieldNumbers,   getManagedFields,   getObjectIdClass,   getPackagePrefix,   getPersistenceCapableRootClass,   getPersistenceCapableSuperclass,   getPersistenceCapableSuperclassName,   getPersistentFieldNumbers,   getPersistentFields,   getPersistentNonPrimaryKeyFieldNumbers,   getPersistentRelationshipFieldNumbers,   getPersistentRelationshipFields,   getPersistentSerializableFieldNumbers,   getPrimaryKeyFieldNumbers,   getPrimaryKeyFields,   getShortName,   isXMLMetadataLoaded,   newJDOClassInstance,   newJDOFieldInstance,   newJDOPropertyInstance,   newJDOPropertyInstance,   removeDeclaredMember,   requiresExtent,   setDeclaredObjectIdClassName,   setDeclaringModel,   setIdentityType,   setJDOPackage,   setJavaType,   setObjectIdClass,   setPersistenceCapableSuperclass,   setPersistenceCapableSuperclassName,   setRequiresExtent,   setShortName,   setXMLMetadataLoaded
Methods from org.apache.jdo.impl.model.jdo.JDOMemberImpl:
compareTo,   equals,   getDeclaringClass,   getName,   hashCode,   toString
Methods from org.apache.jdo.impl.model.jdo.JDOElementImpl:
addPropertyChangeListener,   addVetoableChangeListener,   createJDOExtension,   firePropertyChange,   fireVetoableChange,   getJDOExtensions,   removeJDOExtension,   removePropertyChangeListener,   removeVetoableChangeListener
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.jdo.impl.model.jdo.JDOClassImplDynamic Detail:
 public JDOClass createJDOClass(String name) throws ModelException 
    This method returns a JDOClass instance representing an inner class of this JDOClass If this JDOClass already declares such an inner class, the existing JDOClass instance is returned. Otherwise, it creates a new JDOClass instance, sets its declaring JDOClass and returns the new instance.
 public JDOField createJDOField(String name) throws ModelException 
    This method returns a JDOField instance for the field with the specified name. If this JDOClass already declares such a field, the existing JDOField instance is returned. Otherwise, it creates a new JDOField instance, sets its declaring JDOClass and returns the new instance.

    Note, if the field numbers for the managed fields of this JDOClass are calculated, this methid will fail to create a new JDOField. Any new field would possibly invalidate existing field number

 public JDOProperty createJDOProperty(String name) throws ModelException 
    This method returns a JDOProperty instance for the property with the specified name. If this JDOClass already declares such a property, the existing JDOProperty instance is returned. Otherwise, it creates a new JDOProperty instance, sets its declaring JDOClass and returns the new instance.
 public JDOProperty createJDOProperty(String name,
    JDOField associatedJDOField) throws ModelException 
    This method returns a JDOProperty instance for the property with the specified name and associated field. If this JDOClass already declares such a property the existing JDOProperty instance is returned. If it declares a property with the specified name but different associated field, then a ModelException is thrown. If there is no such property, the method creates a new JDOProperty instance, sets its declaring JDOClass and associated field and returns the new instance.
 public JDOProperty getAssociatedProperty(String name) 
    Returns JDOProperty metadata for a property with the specified name having an associated JDOField. The method returns null, if the name does not denote a property with an associated JDOField of this JDOClass. Please note, the method does not check for properties without an associated JDOField. It will return null if there is a property with the specified name, but this property does not have an associated JDOField.
 public JDOProperty getAssociatedProperty(JDOField field) 
    Returns JDOProperty metadata for a property having the specified JDOField as associated JDOField. The method returns null, if this JDOClass does not have a property with the specified JDOField as associated JDOField.
 public JDOClass[] getDeclaredClasses() 
    Returns the collection of JDOClass instances declared by this JDOClass.
 public JDOField getDeclaredField(String name) 
    Returns JDOField metadata for a particular declared field for the specified name. Please note, the method does not return inherited fields. The field name must not be qualified by a class name. The method returns null if the field name does not denote a field declared by JDOClass.
 public JDOField[] getDeclaredFields() 
    Returns the collection of JDOField instances declared by this JDOClass in the form of an array. This does not include inherited fields.
 public int getDeclaredManagedFieldCount() 
    Returns the number of managed fields declared in the class represented by this JDOClass. This does not include inherited fields.
 public JDOField[] getDeclaredManagedFields() 
 public JDOMember[] getDeclaredMembers() 
    Returns the collection of JDOMember instances declared by this JDOClass in form of an array.
 public String getDeclaredObjectIdClassName() 
    Get the fully qualified name of the object identity class (primary key class) for this JDOClass.
 protected JDOField[] getDeclaredPrimaryKeyFields() 
    Returns the collection of identifying declared fields of this JDOClass in the form of an array. The method returns the JDOField instances declared by this JDOClass defined as primary key fields (see JDOField#isPrimaryKey ).
 public JDOModel getDeclaringModel() 
    Returns the declaring JDOModel of this JDOClass.
 public JDOField[] getDefaultFetchGroupFields() 
    Returns the collection of default fetch group fields of this JDOClass in the form of an array. The method returns the JDOField instances defined as part of the default fetch group (method JDOField#isDefaultFetchGroup returns true.
 public JDOField getField(String fieldName) 
    Returns JDOField metadata for a particular field specified by field name. It returns null if the specified name does not denote a field of this JDOClass.

    The method supports lookup by unqualified and by qualified field name.

    • In the case of an unqualified field name the method starts checking this JDOClass for a field with the specified name. If this class does not define such a field, it checks the inheritance hierarchy starting with its direct persistence-capable superclass. The method finds the first field with the specified name in a bootom-up lookup of the inheritance hierarchy. Hidden fields are not visible.
    • In the case of a qualified field name the method assumes a fully qualified class name (called qualifier class) as the field qualifier. The qualifier class must be a either this class or a persistence-capable superclass (direct or indirect) of this class. Then the method searches the field definition in the inheritance hierarchy staring with the qualifier class. Any field declarations with the same name in subclasses of the qualifier class are not considered. This form allows accessing fields hidden by subclasses. The method returns null if the qualifier class does not denote a valid class or if the qualifier class is not a persistence-capable superclass of this class.
 public JDOField getField(int fieldNumber) 
 protected JDOField getFieldInternal(String fieldName) 
    Returns the JDOField definition for the specified field. The method expects unqualified field names. The method performs a bottom up lookup in the case of multiple fields with the same name in an inheritance hierarchy. So it starts checking this class, then it checks its superclas, etc.
 public int getIdentityType() 
    Get the JDO identity type of this JDOClass. The identity type of the least-derived persistence-capable class defines the identity type for all persistence-capable classes that extend it. The identity type of the least-derived persistence-capable class is defaulted to JDOIdentityType#APPLICATION if objectid-class is specified, and JDOIdentityType#DATASTORE , if not.
 public int getInheritedManagedFieldCount() 
    Returns the number of inherited managed fields for the class represented by this JDOClass.
 public JDOPackage getJDOPackage() 
    Returns the JDOPackage instance corresponding to the package name of this JDOClass.
 public JavaType getJavaType() 
    Provides the JavaType representaion corresponding to this JDOClass.

    Note the difference between Object.getClass() and this method. The former returns the class of the object in hand, this returns the class of the object represented by this meta data.

 public JDOField getManagedField(String fieldName) 
    Returns JDOField metadata for a particular managed field specified by field name. It returns null if the specified name does not denote a managed field of this JDOClass. The field name may be unqualified and or qualified (see #getField(String fieldName) ).
 public int getManagedFieldCount() 
    Returns the number of managed fields for the class represented by this JDOClass. The value returned by this method is equal to getDeclaredManagedFieldCount() + getInheritedManagedFieldCount().
 public int[] getManagedFieldNumbers() 
 public JDOField[] getManagedFields() 
 public JavaType getObjectIdClass() 
    Get the JavaType representation of the object identity class (primary key class) for this JDOClass.
 public String getPackagePrefix() 
    Returns the package name including a terminating dot if this class has a package. The method returns the empty string if this class is in the default package.
 public JDOClass getPersistenceCapableRootClass() 
    Returns the least-derived (topmost) persistence-capable class in the hierarchy of this JDOClass. It returns this JDOClass if it has no persistence-capable superclass.
 public JDOClass getPersistenceCapableSuperclass() 
    Returns the JDOClass instance for the persistence-capable superclass of this JDOClass. If this class does not have a persistence-capable superclass then null is returned.
 public String getPersistenceCapableSuperclassName() 
    Get the fully qualified class name of the persistence-capable superclass of the persistence-capable class described by this JDOClass. If this class does not have a persistence-capable superclass then null is returned.
 public int[] getPersistentFieldNumbers() 
 public JDOField[] getPersistentFields() 
    Returns the collection of persistent JDOField instances of this JDOClass in the form of an array. The returned array includes inherited fields. A field is a persistent field, if it has the persistence-modifier org.apache.jdo.model.jdo.PersistenceModifier#PERSISTENT . Please note, the position of the fields in the returned array might not equal their absolute field number as returned by JDOField#getFieldNumber() .
 public int[] getPersistentNonPrimaryKeyFieldNumbers() 
 public int[] getPersistentRelationshipFieldNumbers() 
 public JDOField[] getPersistentRelationshipFields() 
 public int[] getPersistentSerializableFieldNumbers() 
 public int[] getPrimaryKeyFieldNumbers() 
    Returns an array of absolute field numbers of the identifying fields of this JDOClass. A field number is included in the returned array, iff the corresponding JDOField instance is defined as primary key field (see JDOField#isPrimaryKey ).
 public JDOField[] getPrimaryKeyFields() 
    Returns the collection of identifying fields of this JDOClass in the form of an array. The method returns the JDOField instances defined as primary key fields (see JDOField#isPrimaryKey ).
 public String getShortName() 
    Get the short name of this JDOClass. The short name defaults to the unqualified class name, if not explicitly set by method #setShortName(String shortName) .
 public boolean isXMLMetadataLoaded() 
    Determines whether the XML metadata for the class represented by this JDOClass has been loaded.
 protected JDOClass newJDOClassInstance(String name) 
    Returns a new instance of the JDOClass implementation class.
 protected JDOField newJDOFieldInstance(String name) 
    Returns a new instance of the JDOField implementation class.
 protected JDOProperty newJDOPropertyInstance(String name) 
    Returns a new instance of the JDOProperty implementation class.
 protected JDOProperty newJDOPropertyInstance(String name,
    JDOField associatedJDOField) throws ModelException 
    Returns a new instance of the JDOProperty implementation class.
 public  void removeDeclaredMember(JDOMember member) throws ModelException 
    Remove the supplied member from the collection of members maintained by this JDOClass.
 public boolean requiresExtent() 
    Determines whether an extent must be managed for the persistence-capable class described by this JDOClass.
 public  void setDeclaredObjectIdClassName(String declaredObjectIdClassName) 
    Set the fully qualified name of the object identity class (primary key class) for this JDOClass.
 public  void setDeclaringModel(JDOModel model) 
    Set the declaring JDOModel for this JDOClass.
 public  void setIdentityType(int identityType) 
    Set the object identity type of this JDOClass.
 public  void setJDOPackage(JDOPackage jdoPackage) 
    Sets the JDOPackage instance corresponding to the package name of this JDOClass.
 public  void setJavaType(JavaType javaType) 
    Set the JavaType representation corresponding to this JDOClass.
 public  void setObjectIdClass(JavaType objectIdClass) 
    Set the JavaType representation of the object identity class (primary key class) for this JDOClass.
 public  void setPersistenceCapableSuperclass(JDOClass pcSuperclass) 
    Set the JDOClass for the persistence-capable superclass of this JDOClass.
 public  void setPersistenceCapableSuperclassName(String pcSuperclassName) 
    Set the fully qualified class name of the persistence-capable superclass of the persistence-capable class described by this JDOClass.
 public  void setRequiresExtent(boolean requiresExtent) 
    Set whether an extent must be managed for the persistence-capable class described by this JDOClass.
 public  void setShortName(String shortName) 
    Set the short name of this JDOClass.
 public  void setXMLMetadataLoaded() 
    Sets the flag indicating that the class XML metadata for this JDOClass is loaded to true.