Save This Page
Home » apache-openjpa-1.1.0-source » org.apache.openjpa » meta » [javadoc | source]
org.apache.openjpa.meta
public class: ClassMetaData [javadoc | source]
java.lang.Object
   org.apache.openjpa.meta.Extensions
      org.apache.openjpa.meta.ClassMetaData

All Implemented Interfaces:
    Commentable, SourceTracker, MetaDataModes, MetaDataContext, Comparable, Serializable

Direct Known Subclasses:
    ClassMapping

Contains metadata about a persistent type. This metadata is available both at enhancement time and runtime. Note that this class employs aggressive caching, and therefore it is important to finalize the configuration of field metadatas before invoking methods that depend on that configuration, such as #getPrimaryKeyFields .
Field Summary
public static final  int ID_UNKNOWN    Unkonwn identity type. 
public static final  int ID_DATASTORE    Datastore identity type. 
public static final  int ID_APPLICATION    Application identity type. 
public static final  int ACCESS_UNKNOWN    Unknown access type. 
public static final  int ACCESS_FIELD    Persistent attributes are accessed via direct field access. Bit flag. 
public static final  int ACCESS_PROPERTY    Persistent attributes are accessed via setters and getters. Bit flag. 
public static final  String SYNTHETIC    Value for using a synthetic detached state field, which is the default. 
protected static final  String DEFAULT_STRING     
Fields inherited from org.apache.openjpa.meta.Extensions:
OPENJPA
Constructor:
 protected ClassMetaData(ValueMetaData owner) 
    Embedded constructor. Supply embedding value.
 protected ClassMetaData(Class type,
    MetaDataRepository repos) 
    Constructor. Supply described type and repository.
Method from org.apache.openjpa.meta.ClassMetaData Summary:
addDeclaredFetchGroup,   addDeclaredField,   addDeclaredInterface,   addDefinedSuperclassField,   addExtensionKeys,   clearAllFieldCache,   clearDefinedFieldCache,   clearExtraFieldDataTable,   clearFieldCache,   clearSubclassCache,   compareTo,   copy,   defineSuperclassFields,   equals,   getAccessType,   getComments,   getCustomFetchGroups,   getDataCache,   getDataCacheName,   getDataCacheTimeout,   getDeclaredFetchGroups,   getDeclaredField,   getDeclaredField,   getDeclaredFields,   getDeclaredInterfaces,   getDeclaredUnmanagedFields,   getDefaultFetchGroupFields,   getDefinedFields,   getDefinedFieldsInListingOrder,   getDefinedSuperclassField,   getDescribedType,   getDetachedState,   getDetachedStateField,   getEmbeddingMetaData,   getEnvClassLoader,   getExtraFieldDataIndex,   getExtraFieldDataLength,   getFetchGroup,   getField,   getField,   getFields,   getFieldsInListingOrder,   getIdentitySequenceMetaData,   getIdentitySequenceName,   getIdentityStrategy,   getIdentityType,   getInterfaceAliasedProperties,   getInterfaceImpl,   getInterfacePropertyAlias,   getLifecycleMetaData,   getListingIndex,   getMappedPCSubclassMetaDatas,   getMappedPCSuperclassMetaData,   getObjectIdType,   getPCSubclassMetaDatas,   getPCSubclasses,   getPCSuperclass,   getPCSuperclassMetaData,   getPrimaryKeyFields,   getRepository,   getRequiresExtent,   getResolve,   getResourceName,   getSourceFile,   getSourceMode,   getSourceScope,   getSourceType,   getSuperclassField,   getTypeAlias,   getVersionField,   hashCode,   initializeMapping,   isAccessibleField,   isDetachable,   isEmbeddedOnly,   isIntercepting,   isManagedInterface,   isMapped,   isObjectIdTypeShared,   isOpenJPAIdentity,   removeDeclaredFetchGroup,   removeDeclaredField,   removeDeclaredInterface,   removeDefinedSuperclassField,   resolve,   resolveMapping,   resolveMeta,   setAccessType,   setComments,   setDataCacheName,   setDataCacheTimeout,   setDescribedType,   setDetachable,   setDetachedState,   setEmbeddedOnly,   setEnvClassLoader,   setIdentitySequenceName,   setIdentityStrategy,   setIdentityType,   setIntercepting,   setInterfaceImpl,   setInterfacePropertyAlias,   setListingIndex,   setManagedInterface,   setObjectIdType,   setPCSuperclass,   setPCSuperclassMetaData,   setRequiresExtent,   setResolve,   setResolve,   setSource,   setSourceMode,   setSourceMode,   setTypeAlias,   toString,   usesDetachedState,   validateMapping,   validateMeta
Methods from org.apache.openjpa.meta.Extensions:
addExtension,   addExtension,   addExtensionKeys,   copy,   getBooleanExtension,   getBooleanExtension,   getDoubleExtension,   getDoubleExtension,   getEmbeddedExtensions,   getEmbeddedExtensions,   getExtensionKeys,   getExtensionKeys,   getExtensionVendors,   getIntExtension,   getIntExtension,   getObjectExtension,   getObjectExtension,   getRepository,   getStringExtension,   getStringExtension,   hasExtension,   hasExtension,   isEmpty,   removeEmbeddedExtensions,   removeEmbeddedExtensions,   removeExtension,   removeExtension,   validateDataStoreExtensionPrefix,   validateExtensionKeys
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.openjpa.meta.ClassMetaData Detail:
 public FetchGroup addDeclaredFetchGroup(String name) 
    Adds fetch group of the given name, or returns existing instance.
 public FieldMetaData addDeclaredField(String name,
    Class type) 
    Add a new field metadata to this class.
 public  void addDeclaredInterface(Class iface) 
    Explicitly declare the given interface among the ones this class implements.
 public FieldMetaData addDefinedSuperclassField(String name,
    Class type,
    Class sup) 
    Add a new defined superclass field metadata to this class.
 protected  void addExtensionKeys(Collection exts) 
 protected  void clearAllFieldCache() 
    Clear cached field data.
 protected  void clearDefinedFieldCache() 
    Clear defined field data.
  void clearExtraFieldDataTable() 
    Clear impl data and intermediate data table.
 protected  void clearFieldCache() 
    Clear cached field data.
 protected  void clearSubclassCache() 
    Clear cached subclass data.
 public int compareTo(Object other) 
 public  void copy(ClassMetaData meta) 
    Copy the metadata from the given instance to this one. Do not copy mapping information.
 public  void defineSuperclassFields(boolean force) 
    Incorporate superclass fields redefined in this subclass into this metadata. This method is generally called after metadata is resolved and mapping information is loaded, but before mapping resolve.
 public boolean equals(Object other) 
 public int getAccessType() 
 public String[] getComments() 
 public FetchGroup[] getCustomFetchGroups() 
    Return all fetch groups for this type, including superclass groups.
 public DataCache getDataCache() 
    Return the data cache for this class, or null if it is not cachable.
 public String getDataCacheName() 
    The name of the datacache to use for this class, or null if none.
 public int getDataCacheTimeout() 
    The cache timeout for this class. -1 indicates no timeout.
 public FetchGroup[] getDeclaredFetchGroups() 
    Return the fetch groups declared explicitly in this type.
 public FieldMetaData getDeclaredField(int index) 
    Return the metadata for the persistent or transactional field with the given relative index.
 public FieldMetaData getDeclaredField(String name) 
    Return the metadata for the persistent or transactional field with the given name, without including superclass fields.
 public FieldMetaData[] getDeclaredFields() 
    Return only the fields for this class, without superclass fields.
 public Class[] getDeclaredInterfaces() 
    Return all explicitly declared interfaces this class implements.
 public FieldMetaData[] getDeclaredUnmanagedFields() 
    Return any fields that were added as non-managed. All other methods to get fields return only those that are managed.
 public FieldMetaData[] getDefaultFetchGroupFields() 
    Return the list of fields in the default fetch group, including superclass fields, or an empty array if none.
 public FieldMetaData[] getDefinedFields() 
    Returns an array of all the fields defined by this class. This includes mapped declared fields and any concrete mapping of unmapped superclass fields performed by this class.
 public FieldMetaData[] getDefinedFieldsInListingOrder() 
    Returns all fields defined by this class in the order they are listed in the metadata file. Unlisted fields are placed after listed ones. This array includes declared transactional and unmanaged fields.
 public FieldMetaData getDefinedSuperclassField(String name) 
    Return the defined superclass field with the given name, or null if none.
 public Class getDescribedType() 
    The persistence capable class described by this metadata.
 public String getDetachedState() 
    The name of the detach state field, or null if none.
 public Field getDetachedStateField() 
    Return the detach state field, or null if none.
 public ValueMetaData getEmbeddingMetaData() 
    If this metadata is for an embedded object, returning the owning value.
 public ClassLoader getEnvClassLoader() 
    The environmental loader used when loading this metadata. The class metadata should use this loader when loading metadata for its superclass and field types.
 public int getExtraFieldDataIndex(int field) 
    Return the impl / intermediate field data index of the given field in the compacted array, or -1 if the field does not use extra data.
 public int getExtraFieldDataLength() 
    Return the number of fields that use impl or intermediate data, in order to create a compacted array for storage of said data.
 public FetchGroup getFetchGroup(String name) 
    Gets a named fecth group. If not available in this receiver then looks up the inheritence hierarchy.
 public FieldMetaData getField(int index) 
    Return the metadata for the persistent or transactional field with the given absolute index.
 public FieldMetaData getField(String name) 
    Return the metadata for the persistent or transactional field with the given name.
 public FieldMetaData[] getFields() 
    Return all field metadatas, including superclass fields.
 public FieldMetaData[] getFieldsInListingOrder() 
    Returns all fields in the order they are listed in the metadata file. Unlisted fields are placed after listed ones.
 public SequenceMetaData getIdentitySequenceMetaData() 
    Metadata for the datastore identity sequence.
 public String getIdentitySequenceName() 
    The datastore identity sequence name, or null for none.
 public int getIdentityStrategy() 
    The strategy to use for datastore identity generation. One of the constants from ValueStrategies .
 public int getIdentityType() 
    The type of identity being used. This will be one of:
    • #ID_UNKNOWN : unknown identity type
    • #ID_DATASTORE : identity managed by the data store and independent of the fields of the instance
    • #ID_APPLICATION : identity managed by the application and defined by one or more fields of the instance
    If unspecified, defaults to #ID_DATASTORE if there are no primary key fields, and #ID_APPLICATION otherwise.
 public String[] getInterfaceAliasedProperties(Class iface) 
    Return all aliases property named for the given interface.
 public Class getInterfaceImpl() 
    Return the managed interface implementor if any.
 public String getInterfacePropertyAlias(Class iface,
    String orig) 
    Get local field alias for the given interface property.
 public LifecycleMetaData getLifecycleMetaData() 
    Information about lifecycle callbacks for this class.
 public int getListingIndex() 
    The index in which this class was listed in the metadata. Defaults to -1 if this class was not listed in the metadata.
 public ClassMetaData[] getMappedPCSubclassMetaDatas() 
    Return all mapped subclasses.
 public ClassMetaData getMappedPCSuperclassMetaData() 
    Return the closest mapped superclass.
 public Class getObjectIdType() 
    The metadata-specified class to use for the object ID.
 public ClassMetaData[] getPCSubclassMetaDatas() 
    Return the metadata for the known persistence capable subclasses of the described type, or empty array if none or if this is embedded metadata.
 public Class[] getPCSubclasses() 
    Return the known persistence capable subclasses of the described type, or empty array if none or if this is embedded metadata.
 public Class getPCSuperclass() 
    The persistence capable superclass of the described type.
 public ClassMetaData getPCSuperclassMetaData() 
    The metadata for this class' superclass.
 public FieldMetaData[] getPrimaryKeyFields() 
    Return primary key fields, or empty array if none. The order in which the keys are returned will be the order in which the fields are declared, starting at the least-derived superclass and ending with the primary key fields of the most-derived subclass.
 public MetaDataRepository getRepository() 
    Return the owning repository.
 public boolean getRequiresExtent() 
    Whether the type requires extent management.
 public int getResolve() 
    The resolve mode for this metadata.
 public String getResourceName() 
 public File getSourceFile() 
 public int getSourceMode() 
    The source mode this metadata has been loaded under.
 public Object getSourceScope() 
 public int getSourceType() 
 protected FieldMetaData getSuperclassField(FieldMetaData supField) 
    Return the superclass copy of the given field.
 public String getTypeAlias() 
    Returns the alias for the described type, or null if none has been set.
 public FieldMetaData getVersionField() 
    Return the version field for this class, if any.
 public int hashCode() 
 protected  void initializeMapping() 
    Initialize mapping. Logs init message by default.
 public boolean isAccessibleField(String field) 
    Return whether the given name represents a managed or static field of this class, including superclass fields.
 public boolean isDetachable() 
    Whether instances are detachable.
 public boolean isEmbeddedOnly() 
    Whether the type can only be used as an embedded object.
 public boolean isIntercepting() 
    Whether the type's fields are actively intercepted, either by redefinition or enhancement.
 public boolean isManagedInterface() 
    Whether the type is a managed interface.
 public boolean isMapped() 
    Whether this class is mapped to the datastore. By default, only returns false if class is embedded-only, but subclasses might override to allow unmapped other types.
 public boolean isObjectIdTypeShared() 
    Whether this type uses an application identity class that is shared with other classes, and is therefore wrapped in an ObjectId .
 public boolean isOpenJPAIdentity() 
    Whether this type uses OpenJPA identity.
 public boolean removeDeclaredFetchGroup(FetchGroup fg) 
    Remove a declared fetch group.
 public boolean removeDeclaredField(FieldMetaData field) 
    Remove the given field from management.
 public boolean removeDeclaredInterface(Class iface) 
    Remove the given interface from the declared list.
 public boolean removeDefinedSuperclassField(FieldMetaData field) 
    Remove the given field from management.
 public boolean resolve(int mode) 
    Resolve and validate metadata. Return true if already resolved.
 protected  void resolveMapping(boolean runtime) 
    Resolve mapping data. Logs resolve message and resolves super by default.
 protected  void resolveMeta(boolean runtime) 
    Resolve metadata.
 public  void setAccessType(int type) 
 public  void setComments(String[] comments) 
 public  void setDataCacheName(String name) 
    Set the cache name for this class. Set to null to disable caching.
 public  void setDataCacheTimeout(int timeout) 
    The cache timeout for this class. -1 indicates no timeout.
 protected  void setDescribedType(Class type) 
    Set the class descibed by this metadata. The type may be reset when an embedded value changes its declared type.
 public  void setDetachable(boolean detachable) 
    Whether instances are detachable.
 public  void setDetachedState(String field) 
    The name of the detach state field, or null if none.
 public  void setEmbeddedOnly(boolean embed) 
    Whether the type can only be used as an embedded object.
 public  void setEnvClassLoader(ClassLoader loader) 
    The class environmental loader used when loading this metadata. The class metadata should use this loader when loading metadata for its superclass and field types.
 public  void setIdentitySequenceName(String seqName) 
    The datastore identity sequence name, or null for none.
 public  void setIdentityStrategy(int strategy) 
    The strategy to use for datastore identity generation. One of the constants from ValueStrategies .
 public  void setIdentityType(int type) 
    The type of identity being used. This will be one of:
    • #ID_UNKNOWN : unknown identity type
    • #ID_DATASTORE : identity managed by the data store and independent of the fields of the instance
    • #ID_APPLICATION : identity managed by the application and defined by one or more fields of the instance
    If unspecified, defaults to #ID_DATASTORE if there are no primary key fields, and #ID_APPLICATION otherwise.
 public  void setIntercepting(boolean intercepting) 
    Whether the type's fields are actively intercepted, either by redefinition or enhancement.
 public  void setInterfaceImpl(Class impl) 
    Set the managed interface implementor class.
 public  void setInterfacePropertyAlias(Class iface,
    String orig,
    String local) 
    Alias properties from the given interface during queries to the local field.
 public  void setListingIndex(int index) 
    The index in which this field was listed in the metadata. Defaults to -1 if this class was not listed in the metadata.
 public  void setManagedInterface(boolean managedInterface) 
    Whether the type is a managed interface
 public  void setObjectIdType(Class cls,
    boolean shared) 
    The metadata-specified class to use for the object ID.
 public  void setPCSuperclass(Class pc) 
    The persistence capable superclass of the described type.
 public  void setPCSuperclassMetaData(ClassMetaData meta) 
    The metadata for this class' superclass.
 public  void setRequiresExtent(boolean req) 
    Whether the type requires extent management.
 public  void setResolve(int mode) 
    The resolve mode for this metadata.
 public  void setResolve(int mode,
    boolean on) 
    The resolve mode for this metadata.
 public  void setSource(File file,
    int srcType) 
 public  void setSourceMode(int mode) 
    The source mode this metadata has been loaded under.
 public  void setSourceMode(int mode,
    boolean on) 
    The source mode this metadata has been loaded under.
 public  void setTypeAlias(String alias) 
    Sets the alias for the described type. The alias can be any arbitrary string that the implementation can later use to refer to the class. Note that at runtime, only the alias computed when the persistent type was enhanced is used.
 public String toString() 
 public Boolean usesDetachedState() 
    Whether an instance of this type has detached state.
 protected  void validateMapping(boolean runtime) 
    Validate mapping data.
 protected  void validateMeta(boolean runtime) 
    Validate resolved metadata.