org.datanucleus.metadata
Class AbstractMemberMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.AbstractMemberMetaData
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, ColumnMetaDataContainer
Direct Known Subclasses:
FieldMetaData, PropertyMetaData

public abstract class AbstractMemberMetaData
extends MetaData
implements java.lang.Comparable, ColumnMetaDataContainer

Abstract representation of MetaData for a field/property of a class/interface. The term "member" is used to represent either a field or a method(property). The term property is used to represent the name after cutting off any Java-beans style "get" prefix. This class is extended for fields (FieldMetaData) and properties (PropertyMetaData) to provide the explicit support for those components.

Version:
$Revision: 1.20 $
See Also:
Serialized Form

Field Summary
protected  boolean cacheable
          cacheable tag value.
protected  boolean cascadeDelete
          Whether to delete this relation when deleting the owning object (JPA).
protected  boolean cascadePersist
          Whether to persist this relation when persisting the owning object.
protected  boolean cascadeRefresh
          Whether to refresh this relation when refreshing the owning object (JPA).
protected  boolean cascadeUpdate
          Whether to update this relation when updating the owning object.
protected  java.lang.String catalog
          Catalog for the table specified for this field.
protected  java.lang.String className
          Name of the class to which this field really belongs.
protected  java.lang.String column
          column tag value.
protected  ColumnMetaData[] columnMetaData
          Contains the metadata for column(s).
protected  java.util.List columns
          Columns ColumnMetaData
protected  ContainerMetaData container
          Meta-Data of any container.
static int DEFAULT_RECURSION_DEPTH
          Default recursion-depth according to proposed final draft spec, [12.7.2].
protected  java.lang.Boolean defaultFetchGroup
          default-fetch-group tag value.
protected  java.lang.Boolean dependent
          Whether this field contains a reference that should be deleted when deleting this field.
protected  ElementMetaData elementMetaData
          ElementMetaData.
protected  java.lang.Boolean embedded
          embedded tag value.
protected  EmbeddedMetaData embeddedMetaData
          EmbeddedMetaData.
protected  int fieldId
          Id of the field in its class (only for fields managed by JDO).
protected  java.lang.String[] fieldTypes
          Specification of the possible type(s) that can be stored in this field.
protected  ForeignKeyMetaData foreignKeyMetaData
          ForeignKeyMetaData.
protected  java.lang.String fullFieldName
          Cache result of getFullFieldName()
protected  IndexedValue indexed
          The indexing value
protected  IndexMetaData indexMetaData
          IndexMetaData.
protected  byte jdoFieldFlag
          JDO Flags for use in enhancement process - see JDO spec 21.14.
protected  JoinMetaData joinMetaData
          JoinMetaData.
protected  KeyMetaData keyMetaData
          KeyMetaData.
protected  java.lang.String loadFetchGroup
          load-fetch-group value.
protected  java.lang.String mappedBy
          mapped-by tag value.
protected  int modifiers
          Field modifiers
protected  java.lang.String name
          Field name.
protected  NullValue nullValue
          null-value tag value (default is NONE).
protected  boolean ordered
          Temporary flag to signify if the field is ordered.
protected  OrderMetaData orderMetaData
          OrderMetaData.
protected  FieldPersistenceModifier persistenceModifier
          persistence-modifier tag value.
protected  java.lang.Boolean primaryKey
          primary key tag value.
protected  int recursionDepth
          recursion-depth value.
protected  AbstractMemberMetaData[] relatedMemberMetaData
          MetaData for the other end of a relation when this member is a bidirectional relation.
protected  int relationType
          The relation type of this field (1-1, 1-N, M-N, N-1).
protected  java.lang.String schema
          Schema for the table specified for this field.
protected  java.lang.String sequence
          If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.
protected  java.lang.Boolean serialized
          serialized tag value.
protected  boolean storeInLob
          Wrapper for the ugly JPA "lob" so that when being populated we should make this serialised in some way.
protected  java.lang.String table
          Table name for this field.
protected  java.lang.String targetClassName
          Name of the target entity (when used with JPA MetaData on OneToOne, OneToMany etc)
protected  java.lang.Class type
          Field type being represented by this MetaData.
static int UNDEFINED_RECURSION_DEPTH
          Indicates the recursion-depth is not defined.
protected  boolean uniqueConstraint
          Whether to add a unique constraint.
protected  UniqueMetaData uniqueMetaData
          UniqueMetaData.
protected  java.lang.String valueGeneratorName
          Name of a value generator if the user wants to override the default JPOX generator.
protected  ValueMetaData valueMetaData
          ValueMetaData.
protected  IdentityStrategy valueStrategy
          The value-strategy attribute specifies the strategy used to generate values for the field.
 
Fields inherited from class org.datanucleus.metadata.MetaData
extensions, LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME, VENDOR_NAME_OLD
 
Constructor Summary
AbstractMemberMetaData(MetaData parent, AbstractMemberMetaData fmd)
          Convenience constructor to copy the specification from the passed field.
AbstractMemberMetaData(MetaData parent, java.lang.String name)
          Convenience constructor taking defaults
AbstractMemberMetaData(MetaData parent, java.lang.String name, java.lang.String pk, java.lang.String modifier, java.lang.String defaultFetchGroup, java.lang.String nullValue, java.lang.String embedded, java.lang.String serialized, java.lang.String dependent, java.lang.String mappedBy, java.lang.String column, java.lang.String table, java.lang.String catalog, java.lang.String schema, java.lang.String deleteAction, java.lang.String indexed, java.lang.String unique, java.lang.String recursionDepth, java.lang.String loadFetchGroup, java.lang.String valueStrategy, java.lang.String sequence, java.lang.String fieldType)
          Constructor.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 boolean calcIsSecondClassMutable()
          Calculate wether this field should be a second class mutable field.
 int compareTo(java.lang.Object o)
          Comparator method.
 boolean fieldBelongsToClass()
          Accessor for whether the field is for a superclass, and not for this class.
 int getAbsoluteFieldNumber()
          Accessor for the field id
 AbstractClassMetaData getAbstractClassMetaData()
          Convenience accessor for the MetaData of the parent class.
 ArrayMetaData getArray()
          Accessor for an array container for this field.
 java.lang.String getCatalog()
          Accessor for the catalog name
 java.lang.String getClassName()
          Accessor for the fully-qualified class name owning this field.
 java.lang.String getClassName(boolean fully_qualified)
          Convenience to return the class name that this a field of.
 CollectionMetaData getCollection()
          Accessor for a collection container for this field.
 java.lang.String getColumn()
          Accessor for the column
 ColumnMetaData[] getColumnMetaData()
          Acessor for the columns
 ContainerMetaData getContainer()
          Accessor for the container for this field.
 FieldPersistenceModifier getDefaultFieldPersistenceModifier(java.lang.Class c, int modifier, boolean isPCclass)
          Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a PersistentCapable class.
 ElementMetaData getElementMetaData()
          Accessor for elementMetaData
 EmbeddedMetaData getEmbeddedMetaData()
          Accessor for embeddedMetaData
 int getFieldId()
          Accessor for the field id.
 java.lang.String[] getFieldTypes()
          Accessor for the implementation type(s) that can be stored in this field when it is a reference type.
 ForeignKeyMetaData getForeignKeyMetaData()
          Accessor for foreignKeyMetaData
 java.lang.String getFullFieldName()
          Accessor for the full field name.
 IndexMetaData getIndexMetaData()
          Accessor for indexMetaData
 byte getJdoFieldFlag()
          Accessor for the JDO field flag
 JoinMetaData getJoinMetaData()
          Accessor for joinMetaData
 KeyMetaData getKeyMetaData()
          Accessor for keyMetaData
 java.lang.String getLoadFetchGroup()
          Accessor for the (additional) fetch group for loading this field
 MapMetaData getMap()
          Accessor for a map container for this field.
 java.lang.String getMappedBy()
          Accessor for mappedBy
 MetaDataManager getMetaDataManager()
          Convenience accessor for the MetaData Manager in use.
 java.lang.String getName()
          Accessor for the field name
 NullValue getNullValue()
          Accessor for the null-value tag
 OrderMetaData getOrderMetaData()
          Accessor for orderMetaData
protected  MetaData getOverallParentClassMetaData(MetaData metadata)
          Convenience method to navigate back through the parents to find the overall ClassMetaData handling this object.
 FieldPersistenceModifier getPersistenceModifier()
          Accessor for the persistence-modifier tag value
 int getRecursionDepth()
          Accessor for the depth of the fetch when recursing
 AbstractMemberMetaData[] getRelatedMemberMetaData(ClassLoaderResolver clr)
          Accessor for the FieldMetaData of any related field/property (where this field is part of a bidirectional relation).
 AbstractMemberMetaData getRelatedMemberMetaDataForObject(ClassLoaderResolver clr, java.lang.Object thisPC, java.lang.Object otherPC)
          Convenience accessor for the MetaData for the field/property at the other side of the bidirectional relation given the objects at this side and the other side.
 int getRelationType(ClassLoaderResolver clr)
          Accessor for the relation type for this field.
 java.lang.String getSchema()
          Accessor for the schema name
 java.lang.String getSequence()
          If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.
 java.lang.String getTable()
          Accessor for the table name
 java.lang.Class getType()
          Accessor for the field type
 java.lang.String getTypeName()
          Accessor for the field type name
 UniqueMetaData getUniqueMetaData()
          Accessor for uniqueMetaData
 java.lang.String getValueGeneratorName()
          Name of a (user-provided) value generator to override the default JPOX generator for this strategy.
 ValueMetaData getValueMetaData()
          Accessor for valueMetaData
 IdentityStrategy getValueStrategy()
          The value-strategy attribute specifies the strategy used to generate values for the field.
 boolean hasArray()
          Accessor for whether the field has an array
 boolean hasCollection()
          Accessor for whether the field has a collection
 boolean hasContainer()
          Accessor for whether the field has a container.
 boolean hasMap()
          Accessor for whether the field has a map.
 void initialise()
          Initialisation method.
 boolean isAbstract()
          Convenience method to return if this field represents an abstract property.
 boolean isCacheable()
          Accessor for the cacheable tag value.
 boolean isCascadeDelete()
          Accessor for the whether this field should be cascaded at delete
 boolean isCascadePersist()
          Accessor for the whether this field should be cascaded at persist
 boolean isCascadeRefresh()
          Accessor for the whether this field should be cascaded at refresh
 boolean isCascadeUpdate()
          Accessor for the whether this field should be cascaded at update
 boolean isDefaultFetchGroup()
          Accessor for the default-fetch-group tag value
 boolean isDependent()
          Accessor for the dependent attribute indicates that the field contains a reference that is to be deleted from the datastore if the referring instance in which the field is declared is deleted, or if the referring field is nullified.
 boolean isEmbedded()
          Accessor for the embedded tag value.
 boolean isFieldArrayTypePersistable()
          Utility to return if this array field has elements that are Persistable.
 boolean isFieldTypePersistable()
          Utility to return if this field is persistable.
 boolean isFinal()
          Convenience method to return if this field/property is final.
 boolean isJdoField()
          Accessor for whether the field is to be managed by JPOX.
 boolean isPersistentInterface(ClassLoaderResolver clr)
          Convenience method to return if this member relates to a persistent interface.
 boolean isPrimaryKey()
          Accessor for the primary-key tag value.
 boolean isPrivate()
          Convenience method to return if this field/property is private.
abstract  boolean isProperty()
          Whether this uses getter/setter accessors (Property) or used field based access (Field)
 boolean isProtected()
          Convenience method to return if this field/property is protected.
 boolean isPublic()
          Convenience method to return if this field/property is public.
 boolean isRelationOwner(ClassLoaderResolver clr)
          Convenience method for whether this field is the owner of the relation.
 boolean isSerialized()
          Accessor for the serialized tag value
 boolean isStatic()
          Convenience method to return if this field/property is static.
 boolean isTransient()
          Convenience method to return if this field/property is transient.
 void populate(ClassLoaderResolver clr, java.lang.reflect.Field field, java.lang.reflect.Method method, java.lang.ClassLoader primary)
          Method to provide the details of the field being represented by this MetaData hence populating certain parts of the MetaData.
 void setCacheable(boolean cache)
          Convenience method to set the cacheability of this class.
 void setCascadeDelete(boolean cascade)
          Mutator for the cascading of delete operations on this field.
 void setCascadePersist(boolean cascade)
          Mutator for the cascading of persist operations on this field.
 void setCascadeRefresh(boolean cascade)
          Mutator for the cascading of refresh operations on this field.
 void setCascadeUpdate(boolean cascade)
          Mutator for the cascading of update operations on this field.
 void setCatalog(java.lang.String catalog)
          Mutator for the catalog name
 void setContainer(ContainerMetaData conmd)
          Method to set the container for this field (if this field represents a container (collection, map, array).
 void setDefaultFetchGroup(boolean dfg)
          Convenience method to set the DFG if needing setting after construction.
 void setDependent(boolean dependent)
          Mutator for dependent attribute.
 void setElementMetaData(ElementMetaData elementMetaData)
          Mutator for the element MetaData
 void setEmbeddedMetaData(EmbeddedMetaData embeddedMetaData)
          Mutator for the embedded MetaData
 void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
          Mutator for the foreignKey MetaData
 void setIndexMetaData(IndexMetaData indexMetaData)
          Mutator for the index MetaData
 void setJoinMetaData(JoinMetaData joinMetaData)
          Mutator for the join MetaData
 void setKeyMetaData(KeyMetaData keyMetaData)
          Mutator for the key MetaData
 void setLoadFetchGroup(java.lang.String loadFetchGroup)
          Convenience method to set the load fetch group if required after construction.
 void setMappedBy(java.lang.String mappedby)
          Mutator for mappedBy
 void setNotPersistent()
          Convenience method to mark this field as not-persistent.
 void setOrdered()
          Mutator for whether the collection stored in this field is ordered.
 void setOrderMetaData(OrderMetaData orderMetaData)
          Mutator for the order MetaData
 void setPrimaryKey()
          Convenience method to make this field (part of) the primary key.
protected  void setRelation(ClassLoaderResolver clr)
          Convenience method that sets up the relation type of this field, and the reference to any related field when it is bidirectional.
 void setSchema(java.lang.String schema)
          Mutator for the schema name
 void setSequence(java.lang.String sequence)
          If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.
 void setSerialised()
          Convenience method to mark this field to be stored serialised.
 void setStoreInLob()
          Mutator for whetehr to store as a "lob".
 void setTable(java.lang.String table)
          Mutator for the table name
 void setTargetClassName(java.lang.String target)
          Mutator for the target class name.
 void setTransactional()
          Convenience method to mark this field as transactional.
 void setUniqueMetaData(UniqueMetaData uniqueMetaData)
          Mutator for the unique MetaData
 void setValueGeneratorName(java.lang.String generator)
          Mutator for the name of the value generator to use for this strategy.
 void setValueMetaData(ValueMetaData valueMetaData)
          Mutator for the value MetaData
 void setValueStrategy(IdentityStrategy valueStrategy)
          The value-strategy attribute specifies the strategy used to generate values for the field.
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object using a prefix This can be used as part of a facility to output a MetaData file.
 
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtension, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, isInitialised, isPopulated, isUsed, removeExtension, setInitialised, setParent, setPopulated, setUsed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

columnMetaData

protected ColumnMetaData[] columnMetaData
Contains the metadata for column(s).


container

protected ContainerMetaData container
Meta-Data of any container.


embeddedMetaData

protected EmbeddedMetaData embeddedMetaData
EmbeddedMetaData.


joinMetaData

protected JoinMetaData joinMetaData
JoinMetaData.


elementMetaData

protected ElementMetaData elementMetaData
ElementMetaData.


keyMetaData

protected KeyMetaData keyMetaData
KeyMetaData.


valueMetaData

protected ValueMetaData valueMetaData
ValueMetaData.


indexMetaData

protected IndexMetaData indexMetaData
IndexMetaData.


indexed

protected IndexedValue indexed
The indexing value


uniqueMetaData

protected UniqueMetaData uniqueMetaData
UniqueMetaData.


uniqueConstraint

protected final boolean uniqueConstraint
Whether to add a unique constraint.


orderMetaData

protected OrderMetaData orderMetaData
OrderMetaData.


foreignKeyMetaData

protected ForeignKeyMetaData foreignKeyMetaData
ForeignKeyMetaData.


defaultFetchGroup

protected java.lang.Boolean defaultFetchGroup
default-fetch-group tag value.


column

protected java.lang.String column
column tag value.


mappedBy

protected java.lang.String mappedBy
mapped-by tag value.


embedded

protected java.lang.Boolean embedded
embedded tag value.


dependent

protected java.lang.Boolean dependent
Whether this field contains a reference that should be deleted when deleting this field.


serialized

protected java.lang.Boolean serialized
serialized tag value.


cacheable

protected boolean cacheable
cacheable tag value.


cascadePersist

protected boolean cascadePersist
Whether to persist this relation when persisting the owning object.


cascadeUpdate

protected boolean cascadeUpdate
Whether to update this relation when updating the owning object.


cascadeDelete

protected boolean cascadeDelete
Whether to delete this relation when deleting the owning object (JPA). TODO Link this to dependent


cascadeRefresh

protected boolean cascadeRefresh
Whether to refresh this relation when refreshing the owning object (JPA).


loadFetchGroup

protected java.lang.String loadFetchGroup
load-fetch-group value.


DEFAULT_RECURSION_DEPTH

public static final int DEFAULT_RECURSION_DEPTH
Default recursion-depth according to proposed final draft spec, [12.7.2].

See Also:
Constant Field Values

UNDEFINED_RECURSION_DEPTH

public static final int UNDEFINED_RECURSION_DEPTH
Indicates the recursion-depth is not defined. Use default value.

See Also:
Constant Field Values

recursionDepth

protected int recursionDepth
recursion-depth value.


name

protected final java.lang.String name
Field name.


nullValue

protected NullValue nullValue
null-value tag value (default is NONE).


persistenceModifier

protected FieldPersistenceModifier persistenceModifier
persistence-modifier tag value.


primaryKey

protected java.lang.Boolean primaryKey
primary key tag value.


table

protected java.lang.String table
Table name for this field.


catalog

protected java.lang.String catalog
Catalog for the table specified for this field.


schema

protected java.lang.String schema
Schema for the table specified for this field.


valueStrategy

protected IdentityStrategy valueStrategy
The value-strategy attribute specifies the strategy used to generate values for the field. This attribute has the same values and meaning as the strategy attribute in datastoreidentity.


valueGeneratorName

protected java.lang.String valueGeneratorName
Name of a value generator if the user wants to override the default JPOX generator.


sequence

protected java.lang.String sequence
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.


className

protected java.lang.String className
Name of the class to which this field really belongs. Will be null if the field belongs to the parent ClassMetaData, and will have a value if it is an overriding field.


fullFieldName

protected java.lang.String fullFieldName
Cache result of getFullFieldName()


fieldTypes

protected java.lang.String[] fieldTypes
Specification of the possible type(s) that can be stored in this field. This is for the case where the field/property is declared as an interface, or Object and hence can contain derived types. This provides the restriction to a particular type.


type

protected java.lang.Class type
Field type being represented by this MetaData.


modifiers

protected int modifiers
Field modifiers


fieldId

protected int fieldId
Id of the field in its class (only for fields managed by JDO). If the value is -1, the field is NOT managed by JDO or the object hasn't been populated.


relationType

protected int relationType
The relation type of this field (1-1, 1-N, M-N, N-1).


relatedMemberMetaData

protected AbstractMemberMetaData[] relatedMemberMetaData
MetaData for the other end of a relation when this member is a bidirectional relation. This may be multiple fields if the FK is shared.


ordered

protected boolean ordered
Temporary flag to signify if the field is ordered.


columns

protected java.util.List columns
Columns ColumnMetaData


targetClassName

protected java.lang.String targetClassName
Name of the target entity (when used with JPA MetaData on OneToOne, OneToMany etc)


storeInLob

protected boolean storeInLob
Wrapper for the ugly JPA "lob" so that when being populated we should make this serialised in some way.


jdoFieldFlag

protected byte jdoFieldFlag
JDO Flags for use in enhancement process - see JDO spec 21.14.

Constructor Detail

AbstractMemberMetaData

public AbstractMemberMetaData(MetaData parent,
                              java.lang.String name)
Convenience constructor taking defaults

Parameters:
parent - Parent component
name - Name of the field

AbstractMemberMetaData

public AbstractMemberMetaData(MetaData parent,
                              AbstractMemberMetaData fmd)
Convenience constructor to copy the specification from the passed field. This is used when we have an overriding field and we make a copy of the baseline field as a starting point.

Parameters:
parent - The parent
fmd - The field to copy

AbstractMemberMetaData

public AbstractMemberMetaData(MetaData parent,
                              java.lang.String name,
                              java.lang.String pk,
                              java.lang.String modifier,
                              java.lang.String defaultFetchGroup,
                              java.lang.String nullValue,
                              java.lang.String embedded,
                              java.lang.String serialized,
                              java.lang.String dependent,
                              java.lang.String mappedBy,
                              java.lang.String column,
                              java.lang.String table,
                              java.lang.String catalog,
                              java.lang.String schema,
                              java.lang.String deleteAction,
                              java.lang.String indexed,
                              java.lang.String unique,
                              java.lang.String recursionDepth,
                              java.lang.String loadFetchGroup,
                              java.lang.String valueStrategy,
                              java.lang.String sequence,
                              java.lang.String fieldType)
Constructor. Saves the MetaData with the specified values. The object is then in an "unpopulated" state. It can become "populated" by calling the populate() method which compares it against the field it is to represent and updates any unset attributes and flags up any errors.

Parameters:
parent - parent MetaData instance
name - field name
pk - attribute primary-key value
modifier - attribute persistence-modifier value
defaultFetchGroup - attribute default-fetch-group value
nullValue - attribute null-value value
embedded - attribute embedded value
serialized - attribute serialized value
dependent - attribute dependent value
mappedBy - attribute mapped-by value
column - attribute column value
table - attribute table value
catalog - attribute catalog value
schema - attribute schema value
deleteAction - attribute delete-action value
indexed - Whether this is indexed
unique - Apply a unique constraint
recursionDepth - The depth of fetch to use when recursing
loadFetchGroup - Name of the additional fetch group to use when loading
valueStrategy - attribute value-strategy value
sequence - attribute sequence value
fieldType - Implementation type(s) for field.
Method Detail

populate

public void populate(ClassLoaderResolver clr,
                     java.lang.reflect.Field field,
                     java.lang.reflect.Method method,
                     java.lang.ClassLoader primary)
Method to provide the details of the field being represented by this MetaData hence populating certain parts of the MetaData. This is 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 field being represented. Either a field or a method should be passed in (one or the other) depending on what is being represented by this "member".

Parameters:
clr - ClassLoaderResolver to use for any class loading
field - Field that we are representing (if it's a field)
method - Method(property) that we are representing (if it's a method).
primary - the primary ClassLoader to use (or null)

getDefaultFieldPersistenceModifier

public final FieldPersistenceModifier getDefaultFieldPersistenceModifier(java.lang.Class c,
                                                                         int modifier,
                                                                         boolean isPCclass)
Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a PersistentCapable class. TODO Change this to just return if default persistent, and getFieldPersistenceModifier elsewhere.

Parameters:
c - The class
modifier - The modifiers for the field
isPCclass - Whether it is persistence capable.
Returns:
The default field PersistenceModifier.

initialise

public void initialise()
Initialisation method. This should be called AFTER using the populate method if you are going to use populate. It creates the internal convenience arrays etc needed for normal operation.

Overrides:
initialise in class MetaData

isFieldTypePersistable

public boolean isFieldTypePersistable()
Utility to return if this field is persistable. Not valid for use by the enhancer. Must be overridden for that mode.

Returns:
Whether the field type is persistable.

isFieldArrayTypePersistable

public boolean isFieldArrayTypePersistable()
Utility to return if this array field has elements that are Persistable. Not valid for use by the enhancer. Must be overridden for that mode. If the field is not an array will return false.

Returns:
Whether the field type is persistable.

isStatic

public boolean isStatic()
Convenience method to return if this field/property is static. When the object is not "populated" always returns false;

Returns:
Whether the field/property is static

isFinal

public boolean isFinal()
Convenience method to return if this field/property is final. When the object is not "populated" always returns false;

Returns:
Whether the field is field/property

isTransient

public boolean isTransient()
Convenience method to return if this field/property is transient. When the object is not "populated" always returns false;

Returns:
Whether the field/property is transient

isPublic

public boolean isPublic()
Convenience method to return if this field/property is public. When the object is not "populated" always returns false;

Returns:
Whether the field/property is public

isProtected

public boolean isProtected()
Convenience method to return if this field/property is protected. When the object is not "populated" always returns false;

Returns:
Whether the field/property is protected

isPrivate

public boolean isPrivate()
Convenience method to return if this field/property is private. When the object is not "populated" always returns false;

Returns:
Whether the field/property is private

isAbstract

public boolean isAbstract()
Convenience method to return if this field represents an abstract property.

Returns:
Whether the property is abstract

getValueStrategy

public IdentityStrategy getValueStrategy()
The value-strategy attribute specifies the strategy used to generate values for the field. This attribute has the same values and meaning as the strategy attribute in datastoreidentity.

Returns:
the value strategy

getValueGeneratorName

public java.lang.String getValueGeneratorName()
Name of a (user-provided) value generator to override the default JPOX generator for this strategy.

Returns:
Name of user provided value generator

getSequence

public java.lang.String getSequence()
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.

Returns:
the sequence name

isCacheable

public boolean isCacheable()
Accessor for the cacheable tag value.

Returns:
cacheable tag value

setCacheable

public void setCacheable(boolean cache)
Convenience method to set the cacheability of this class.


getLoadFetchGroup

public java.lang.String getLoadFetchGroup()
Accessor for the (additional) fetch group for loading this field

Returns:
Returns the load fetch group

setLoadFetchGroup

public void setLoadFetchGroup(java.lang.String loadFetchGroup)
Convenience method to set the load fetch group if required after construction.

Parameters:
loadFetchGroup - Name of the load fetch group

getRecursionDepth

public int getRecursionDepth()
Accessor for the depth of the fetch when recursing

Returns:
Returns the depth of the fetch when recursing

getOverallParentClassMetaData

protected MetaData getOverallParentClassMetaData(MetaData metadata)
Convenience method to navigate back through the parents to find the overall ClassMetaData handling this object. This is to cater specifically for nested embedded fields where you can nest object several levels deep.

Parameters:
metadata - The metadata to check
Returns:
The overall class metadata for this element

getAbstractClassMetaData

public AbstractClassMetaData getAbstractClassMetaData()
Convenience accessor for the MetaData of the parent class.

Returns:
Returns the MetaData of the parent class.

getOrderMetaData

public final OrderMetaData getOrderMetaData()
Accessor for orderMetaData

Returns:
Returns the orderMetaData.

getName

public java.lang.String getName()
Accessor for the field name

Returns:
field name

getFullFieldName

public java.lang.String getFullFieldName()
Accessor for the full field name. This prepends the class name.

Returns:
full field name.

fieldBelongsToClass

public boolean fieldBelongsToClass()
Accessor for whether the field is for a superclass, and not for this class.

Returns:
Whether the field belongs to a superclass

getClassName

public java.lang.String getClassName()
Accessor for the fully-qualified class name owning this field.

Returns:
The class name

getClassName

public java.lang.String getClassName(boolean fully_qualified)
Convenience to return the class name that this a field of.

Parameters:
fully_qualified - Whether the name should be fully qualified.
Returns:
Class name

getNullValue

public NullValue getNullValue()
Accessor for the null-value tag

Returns:
null-value tag

getPersistenceModifier

public FieldPersistenceModifier getPersistenceModifier()
Accessor for the persistence-modifier tag value

Returns:
persistence-modifier tag value

setNotPersistent

public void setNotPersistent()
Convenience method to mark this field as not-persistent.


setTransactional

public void setTransactional()
Convenience method to mark this field as transactional.


isDefaultFetchGroup

public boolean isDefaultFetchGroup()
Accessor for the default-fetch-group tag value

Returns:
default-fetch-group tag value

setDefaultFetchGroup

public void setDefaultFetchGroup(boolean dfg)
Convenience method to set the DFG if needing setting after construction.

Parameters:
dfg - DFG string value

isDependent

public boolean isDependent()
Accessor for the dependent attribute indicates that the field contains a reference that is to be deleted from the datastore if the referring instance in which the field is declared is deleted, or if the referring field is nullified.

Returns:
dependent tag value

isEmbedded

public boolean isEmbedded()
Accessor for the embedded tag value. This value is a hint only to the implementation so will not mean that the type is certainly embedded.

Returns:
embedded tag value

isSerialized

public boolean isSerialized()
Accessor for the serialized tag value

Returns:
serialized tag value

setSerialised

public void setSerialised()
Convenience method to mark this field to be stored serialised.


isCascadePersist

public boolean isCascadePersist()
Accessor for the whether this field should be cascaded at persist

Returns:
Whether to cascade at persist

isCascadeUpdate

public boolean isCascadeUpdate()
Accessor for the whether this field should be cascaded at update

Returns:
Whether to cascade at update

isCascadeDelete

public boolean isCascadeDelete()
Accessor for the whether this field should be cascaded at delete

Returns:
Whether to cascade at delete

isCascadeRefresh

public boolean isCascadeRefresh()
Accessor for the whether this field should be cascaded at refresh

Returns:
Whether to cascade at refresh

isPrimaryKey

public boolean isPrimaryKey()
Accessor for the primary-key tag value.

Returns:
primary-key tag value.

setPrimaryKey

public void setPrimaryKey()
Convenience method to make this field (part of) the primary key.


isProperty

public abstract boolean isProperty()
Whether this uses getter/setter accessors (Property) or used field based access (Field)

Returns:
true if this is a property

getTable

public java.lang.String getTable()
Accessor for the table name

Returns:
table name

getCatalog

public java.lang.String getCatalog()
Accessor for the catalog name

Returns:
catalog name

getSchema

public java.lang.String getSchema()
Accessor for the schema name

Returns:
schema name

getFieldId

public int getFieldId()
Accessor for the field id. Not set when the field is an overriding field.

Returns:
field id

getFieldTypes

public final java.lang.String[] getFieldTypes()
Accessor for the implementation type(s) that can be stored in this field when it is a reference type.

Returns:
Returns the implementation type(s) for the field.

getAbsoluteFieldNumber

public int getAbsoluteFieldNumber()
Accessor for the field id

Returns:
field id

getType

public java.lang.Class getType()
Accessor for the field type

Returns:
Reflection field type

getTypeName

public java.lang.String getTypeName()
Accessor for the field type name

Returns:
Reflection field type name

getContainer

public ContainerMetaData getContainer()
Accessor for the container for this field.

Returns:
The MetaData of the container for this field.

getArray

public ArrayMetaData getArray()
Accessor for an array container for this field. Returns null if no array attached.

Returns:
The MetaData of the container for this field if an array

getCollection

public CollectionMetaData getCollection()
Accessor for a collection container for this field. Returns null if no collection attached.

Returns:
The MetaData of the container for this field if a Collection.

getMap

public MapMetaData getMap()
Accessor for a map container for this field. Returns null if no map attached.

Returns:
The MetaData of the container for this field if a Map.

getColumn

public final java.lang.String getColumn()
Accessor for the column

Returns:
Returns the column.

getMappedBy

public final java.lang.String getMappedBy()
Accessor for mappedBy

Returns:
Returns the mappedBy.

getColumnMetaData

public final ColumnMetaData[] getColumnMetaData()
Acessor for the columns

Specified by:
getColumnMetaData in interface ColumnMetaDataContainer
Returns:
Returns the columnMetaData.

getElementMetaData

public final ElementMetaData getElementMetaData()
Accessor for elementMetaData

Returns:
Returns the elementMetaData.

getKeyMetaData

public final KeyMetaData getKeyMetaData()
Accessor for keyMetaData

Returns:
Returns the keyMetaData.

getValueMetaData

public final ValueMetaData getValueMetaData()
Accessor for valueMetaData

Returns:
Returns the valueMetaData.

getEmbeddedMetaData

public final EmbeddedMetaData getEmbeddedMetaData()
Accessor for embeddedMetaData

Returns:
Returns the embeddedMetaData.

getForeignKeyMetaData

public final ForeignKeyMetaData getForeignKeyMetaData()
Accessor for foreignKeyMetaData

Returns:
Returns the foreignKeyMetaData.

getIndexMetaData

public final IndexMetaData getIndexMetaData()
Accessor for indexMetaData

Returns:
Returns the indexMetaData.

getUniqueMetaData

public final UniqueMetaData getUniqueMetaData()
Accessor for uniqueMetaData

Returns:
Returns the uniqueMetaData.

getJoinMetaData

public final JoinMetaData getJoinMetaData()
Accessor for joinMetaData

Returns:
Returns the joinMetaData.

addColumn

public void addColumn(ColumnMetaData colmd)
Add a new ColumnMetaData element

Specified by:
addColumn in interface ColumnMetaDataContainer
Parameters:
colmd - the ColumnMetaData to add

hasContainer

public boolean hasContainer()
Accessor for whether the field has a container.

Returns:
Whether it represents a container.

hasArray

public boolean hasArray()
Accessor for whether the field has an array

Returns:
return true if has array

hasCollection

public boolean hasCollection()
Accessor for whether the field has a collection

Returns:
return true if has collection

hasMap

public boolean hasMap()
Accessor for whether the field has a map.

Returns:
return true if has map

getJdoFieldFlag

public byte getJdoFieldFlag()
Accessor for the JDO field flag

Returns:
JDO Field flag (for enhancing)

isJdoField

public boolean isJdoField()
Accessor for whether the field is to be managed by JPOX.

Returns:
Whether it is JPOX managed

setOrdered

public void setOrdered()
Mutator for whether the collection stored in this field is ordered. Only valid until the metadata is initialised.


setTargetClassName

public void setTargetClassName(java.lang.String target)
Mutator for the target class name. Only valid until the metadata is initialised.

Parameters:
target - Target class name

setStoreInLob

public void setStoreInLob()
Mutator for whetehr to store as a "lob".


setCascadePersist

public void setCascadePersist(boolean cascade)
Mutator for the cascading of persist operations on this field.

Parameters:
cascade - Whether to cascade at persist

setCascadeUpdate

public void setCascadeUpdate(boolean cascade)
Mutator for the cascading of update operations on this field.

Parameters:
cascade - Whether to cascade at update

setCascadeDelete

public void setCascadeDelete(boolean cascade)
Mutator for the cascading of delete operations on this field.

Parameters:
cascade - Whether to cascade at delete

setCascadeRefresh

public void setCascadeRefresh(boolean cascade)
Mutator for the cascading of refresh operations on this field.

Parameters:
cascade - Whether to cascade at refresh

setValueStrategy

public void setValueStrategy(IdentityStrategy valueStrategy)
The value-strategy attribute specifies the strategy used to generate values for the field. This attribute has the same values and meaning as the strategy attribute in datastoreidentity.

Parameters:
valueStrategy - the value strategy

setValueGeneratorName

public void setValueGeneratorName(java.lang.String generator)
Mutator for the name of the value generator to use for this strategy.

Parameters:
generator - Name of value generator

setSequence

public void setSequence(java.lang.String sequence)
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.

Parameters:
sequence - the sequence name

setDependent

public void setDependent(boolean dependent)
Mutator for dependent attribute.

Parameters:
dependent - Whether it is dependent.

setMappedBy

public void setMappedBy(java.lang.String mappedby)
Mutator for mappedBy

Parameters:
mappedby - The mapped-by field.

setContainer

public void setContainer(ContainerMetaData conmd)
Method to set the container for this field (if this field represents a container (collection, map, array).

Parameters:
conmd - The MetaData of the container for this field.

setElementMetaData

public final void setElementMetaData(ElementMetaData elementMetaData)
Mutator for the element MetaData

Parameters:
elementMetaData - The elementMetaData to set.

setKeyMetaData

public final void setKeyMetaData(KeyMetaData keyMetaData)
Mutator for the key MetaData

Parameters:
keyMetaData - The keyMetaData to set.

setOrderMetaData

public final void setOrderMetaData(OrderMetaData orderMetaData)
Mutator for the order MetaData

Parameters:
orderMetaData - The orderMetaData to set.

setValueMetaData

public final void setValueMetaData(ValueMetaData valueMetaData)
Mutator for the value MetaData

Parameters:
valueMetaData - The valueMetaData to set.

setEmbeddedMetaData

public final void setEmbeddedMetaData(EmbeddedMetaData embeddedMetaData)
Mutator for the embedded MetaData

Parameters:
embeddedMetaData - The embeddedMetaData to set.

setForeignKeyMetaData

public final void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
Mutator for the foreignKey MetaData

Parameters:
foreignKeyMetaData - The foreignKeyMetaData to set.

setIndexMetaData

public final void setIndexMetaData(IndexMetaData indexMetaData)
Mutator for the index MetaData

Parameters:
indexMetaData - The indexMetaData to set.

setUniqueMetaData

public final void setUniqueMetaData(UniqueMetaData uniqueMetaData)
Mutator for the unique MetaData

Parameters:
uniqueMetaData - The uniqueMetaData to set.

setJoinMetaData

public final void setJoinMetaData(JoinMetaData joinMetaData)
Mutator for the join MetaData

Parameters:
joinMetaData - The joinMetaData to set.

setTable

public void setTable(java.lang.String table)
Mutator for the table name

Parameters:
table - The table name

setCatalog

public void setCatalog(java.lang.String catalog)
Mutator for the catalog name

Parameters:
catalog - The catalog name

setSchema

public void setSchema(java.lang.String schema)
Mutator for the schema name

Parameters:
schema - The schema name

setRelation

protected void setRelation(ClassLoaderResolver clr)
Convenience method that sets up the relation type of this field, and the reference to any related field when it is bidirectional. If the relation is bidirectional then will also set the other side of the relation (to relate to this side). Any member that refers to a PERSISTENT INTERFACE will have relation type as NONE. This should ultimately be changed to reflect the real relation, and relationMemberMetaData should also be set accordingly.

Parameters:
clr - ClassLoader resolver
Throws:
NucleusUserException - If mapped-by doesnt exist at other side

getRelationType

public int getRelationType(ClassLoaderResolver clr)
Accessor for the relation type for this field.

Parameters:
clr - ClassLoader resolver
Returns:
The relation type.

isPersistentInterface

public boolean isPersistentInterface(ClassLoaderResolver clr)
Convenience method to return if this member relates to a persistent interface. All members that have a relation will return NONE from getRelationType but can be accessed through here. TODO Merge this with relation methods so we only need the relationType/relatedMemberMetaData.

Parameters:
clr - ClassLoader resolver
Returns:
Whether it is for a persistent interface

isRelationOwner

public boolean isRelationOwner(ClassLoaderResolver clr)
Convenience method for whether this field is the owner of the relation. If the field has no relation will return true. If the field is in a unidirectional relation will return true. If the field is in a bidirectional relation and has no mapped-by will return true. Otherwise returns false.

Parameters:
clr - ClassLoader resolver
Returns:
Whether it is the owner side of a relation

getRelatedMemberMetaData

public AbstractMemberMetaData[] getRelatedMemberMetaData(ClassLoaderResolver clr)
Accessor for the FieldMetaData of any related field/property (where this field is part of a bidirectional relation). Allows for 1-1, 1-N, and M-N. If this field is not part of a bidirectional relation (no "mapped-by" at either end) then it returns null.

Parameters:
clr - the ClassLoaderResolver
Returns:
The MetaData for the field/property at the "other end".

getRelatedMemberMetaDataForObject

public AbstractMemberMetaData getRelatedMemberMetaDataForObject(ClassLoaderResolver clr,
                                                                java.lang.Object thisPC,
                                                                java.lang.Object otherPC)
Convenience accessor for the MetaData for the field/property at the other side of the bidirectional relation given the objects at this side and the other side.

Parameters:
clr - ClassLoader Resolver
thisPC - This object
otherPC - The related object
Returns:
The MetaData for the field in the related object

calcIsSecondClassMutable

public boolean calcIsSecondClassMutable()
Calculate wether this field should be a second class mutable field. This calculation is a bit expensive. Please note that this data will be cached in AbstractClassMetaData.scoMutableMemberFlags.

Returns:
wether this field should be a second class mutable field.

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object using a prefix This can be used as part of a facility to output a MetaData file.

Overrides:
toString in class MetaData
Parameters:
prefix - prefix string
indent - indent string
Returns:
a string representation of the object.

compareTo

public int compareTo(java.lang.Object o)
Comparator method. This allows the ClassMetaData to search for a FieldMetaData with a particular name.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The object to compare against
Returns:
The comparison result

getMetaDataManager

public MetaDataManager getMetaDataManager()
Convenience accessor for the MetaData Manager in use.

Returns:
MetaDataManager.


Copyright © 2009. All Rights Reserved.