Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.model.jdo » [javadoc | source]
org.apache.jdo.model.jdo
public interface: JDOClass [javadoc | source]

All Implemented Interfaces:
    JDOMember

All Known Implementing Classes:
    JDOClassImplDynamic, JDOClassImplCaching

A JDOClass instance represents the JDO metadata of a persistence-capable class.
Method from org.apache.jdo.model.jdo.JDOClass Summary:
createJDOClass,   createJDOField,   createJDOProperty,   createJDOProperty,   getAssociatedProperty,   getAssociatedProperty,   getDeclaredClasses,   getDeclaredField,   getDeclaredFields,   getDeclaredManagedFieldCount,   getDeclaredManagedFields,   getDeclaredMembers,   getDeclaredObjectIdClassName,   getDeclaringModel,   getDefaultFetchGroupFields,   getField,   getField,   getIdentityType,   getInheritedManagedFieldCount,   getJDOPackage,   getJavaType,   getManagedField,   getManagedFieldCount,   getManagedFieldNumbers,   getManagedFields,   getObjectIdClass,   getPackagePrefix,   getPersistenceCapableRootClass,   getPersistenceCapableSuperclass,   getPersistenceCapableSuperclassName,   getPersistentFieldNumbers,   getPersistentFields,   getPersistentNonPrimaryKeyFieldNumbers,   getPersistentRelationshipFieldNumbers,   getPersistentRelationshipFields,   getPersistentSerializableFieldNumbers,   getPrimaryKeyFieldNumbers,   getPrimaryKeyFields,   getShortName,   isXMLMetadataLoaded,   removeDeclaredMember,   requiresExtent,   setDeclaredObjectIdClassName,   setDeclaringModel,   setIdentityType,   setJDOPackage,   setJavaType,   setObjectIdClass,   setPersistenceCapableSuperclass,   setPersistenceCapableSuperclassName,   setRequiresExtent,   setShortName,   setXMLMetadataLoaded
Method from org.apache.jdo.model.jdo.JDOClass 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.
 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 associatedField) 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 fieldName)
    Returns JDOField metadata for a particular declared field specified by field 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()
    Returns the collection of managed JDOField instances declared by this JDOClass in the form of an array. The returned array does not include inherited fields. A field is a managed field, if it has the persistence-modifier PersistenceModifier#PERSISTENT or PersistenceModifier#TRANSACTIONAL . The position of the fields in the returned array equals their relative field number as returned by JDOField#getRelativeFieldNumber() . The following holds true for any field in the returned array:
    • getDeclaredManagedFields()[i].getRelativeFieldNumber() == i
    • getDeclaredManagedFields()[field.getRelativeFieldNumber()] == field
 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) declared for this JDOClass. Please note, this method returns a non null class name, only if the JDO metadata defines an objectIdClass for exactly the pc class represented by this JDOClass. If there is no objectIdClass defines for this JDOClass, but any of the pc-superclasses defines an objectIdClass, this method returns null. This is different from method #getObjectIdClass which returns a non-null value, if the superclass defines a objectIdClass.
 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)
    Provides metadata for a particular field specified by the absolute field number. The field number must be a valid absolute field number for this JDOClass: 0 <= fieldNumber < this.getManagedFields().length If the field number is valid the returned JDoField instance denotes a managed field, meaning the field has the persistence-modifier PersistenceModifier#PERSISTENT or PersistenceModifier#TRANSACTIONAL . If the field number is not valid then the method returns null.
 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()
    Returns an array of absolute field numbers of the managed fields of this JDOClass. The returned array includes field numbers of inherited fields. A field is a managed field, if it has the persistence-modifier PersistenceModifier#PERSISTENT or PersistenceModifier#TRANSACTIONAL . Only managed fields have a valid field number, thus the field number in the returned array equals its index:
    getManagedFields()[i] == i
 public JDOField[] getManagedFields()
    Returns the collection of managed JDOField instances of this JDOClass in the form of an array. The returned array includes inherited fields. A field is a managed field, if it has the persistence-modifier PersistenceModifier#PERSISTENT or PersistenceModifier#TRANSACTIONAL . The position of the fields in the returned array equals their absolute field number as returned by JDOField#getFieldNumber() . The following holds true for any field in the returned array:
    • getManagedFields()[i].getFieldNumber() == i
    • getManagedFields()[field.getFieldNumber()] == field
 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()
    Returns an array of absolute field numbers of the persistent fields of this JDOClass. The returned array includes field numbers of inherited fields. A persistent field has the persistence-modifier PersistenceModifier#PERSISTENT .
 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 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()
    Returns an array of absolute field numbers of the non identifying, persistent fields of this JDOClass. A field number is included in the returned array, iff the corresponding JDOField instance is persistent and not a not a primary key field (see JDOField#isPrimaryKey ). A field is a persistent field, if it has the persistence-modifier PersistenceModifier#PERSISTENT or (see JDOField#getPersistenceModifier ).
 public int[] getPersistentRelationshipFieldNumbers()
    Returns an array of absolute field numbers of persistent relationship fields of this JDOClass. A field number is included in the returned array, iff the corresponding JDOField instance is a relationship (method JDOField#getRelationship returns a non null value) and has the persistence-modifier PersistenceModifier#PERSISTENT .
 public JDOField[] getPersistentRelationshipFields()
    Returns the collection of persistent relationship fields of this JDOClass in the form of an array. The method returns the JDOField instances defined as relationship (method JDOField#getRelationship returns a non null value) and having the persistence-modifier PersistenceModifier#PERSISTENT .
 public int[] getPersistentSerializableFieldNumbers()
    Returns an array of absolute field numbers of persistent, serializable fields of this JDOClass. A field number is included in the returned array, iff the corresponding JDOField instance is serializable (method JDOField#isSerializable returns true) and has the persistence-modifier PersistenceModifier#PERSISTENT .
 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.
 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) throws ModelException
    Set the fully qualified name of the object identity class (primary key class) declared for this JDOClass.
 public  void setDeclaringModel(JDOModel model)
    Set the declaring JDOModel for this JDOClass.
 public  void setIdentityType(int identityType) throws ModelException
    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) throws ModelException
    Set the JavaType representation corresponding to this JDOClass.
 public  void setObjectIdClass(JavaType objectIdClass) throws ModelException
    Set the JavaType representation of the object identity class (primary key class) for this JDOClass.
 public  void setPersistenceCapableSuperclass(JDOClass pcSuperclass) throws ModelException
    Set the JDOClass for the persistence-capable superclass of this JDOClass.
 public  void setPersistenceCapableSuperclassName(String pcSuperclassName) throws ModelException
    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) throws ModelException
    Set whether an extent must be managed for the persistence-capable class described by this JDOClass.
 public  void setShortName(String shortName) throws ModelException
    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.