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.

See Also:
Serialized Form

Field Summary
protected  boolean cacheable
          cacheable tag value.
protected  java.lang.Boolean cascadeDelete
          Whether to delete this relation when deleting the owning object (JPA).
protected  java.lang.Boolean cascadePersist
          Whether to persist this relation when persisting the owning object.
protected  java.lang.Boolean cascadeRefresh
          Whether to refresh this relation when refreshing the owning object (JPA).
protected  java.lang.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<ColumnMetaData> 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  java.lang.reflect.Member memberRepresented
          The member (field/method) being represented here.
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.
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)
          Constructor for a fields metadata.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 boolean calcIsSecondClassMutable(MetaDataManager mmgr)
          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()
           
 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()
           
 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, MetaDataManager mmgr)
          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.
 IndexedValue getIndexed()
           
 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()
           
 MapMetaData getMap()
          Accessor for a map container for this field.
 java.lang.String getMappedBy()
           
 java.lang.reflect.Member getMemberRepresented()
          Accessor for the member being represented.
 java.lang.String getName()
          Accessor for the field name
 NullValue getNullValue()
           
 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()
           
 int getRecursionDepth()
           
 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()
           
 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()
           
 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()
           
 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(ClassLoaderResolver clr, MetaDataManager mmgr)
          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()
           
 boolean isDependent()
           
 boolean isEmbedded()
          Accessor for the embedded tag value.
 boolean isFieldArrayTypePersistable(MetaDataManager mmgr)
          Utility to return if this array field has elements that are Persistable.
 boolean isFieldTypePersistable(MetaDataManager mmgr)
          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, MetaDataManager mmgr)
          Convenience method to return if this member relates to a persistent interface.
 boolean isPrimaryKey()
           
 boolean isPrivate()
          Convenience method to return if this field/property is private.
 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()
           
 boolean isStatic()
          Convenience method to return if this field/property is static.
 boolean isTransient()
          Convenience method to return if this field/property is transient.
 boolean isUnique()
           
 ArrayMetaData newArrayMetaData()
          Method to create a new array metadata, set it, and return it.
 CollectionMetaData newCollectionMetaData()
          Method to create a new collection metadata, set it, and return it.
 ColumnMetaData newColumnMetaData()
           
 ElementMetaData newElementMetaData()
          Method to create a new element metadata, set it, and return it.
 EmbeddedMetaData newEmbeddedMetaData()
          Method to create a new embedded metadata, set it, and return it.
 ForeignKeyMetaData newForeignKeyMetaData()
          Method to create a new FK metadata, set it, and return it.
 IndexMetaData newIndexMetaData()
          Method to create a new index metadata, set it, and return it.
 JoinMetaData newJoinMetadata()
          Method to create a new JoinMetaData, set it, and return it.
 JoinMetaData newJoinMetaData()
          Method to create a new join metadata, set it, and return it.
 KeyMetaData newKeyMetaData()
          Method to create a new key metadata, set it, and return it.
 MapMetaData newMapMetaData()
          Method to create a new map metadata, set it, and return it.
 OrderMetaData newOrderMetaData()
          Method to create a new order metadata, set it, and return it.
 UniqueMetaData newUniqueMetaData()
          Method to create a new unique metadata, set it, and return it.
 ValueMetaData newValueMetaData()
          Method to create a new value metadata, set it, and return it.
 void populate(ClassLoaderResolver clr, java.lang.reflect.Field field, java.lang.reflect.Method method, java.lang.ClassLoader primary, MetaDataManager mmgr)
          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.
 AbstractMemberMetaData setCatalog(java.lang.String catalog)
           
 AbstractMemberMetaData setColumn(java.lang.String col)
           
 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)
           
 void setDefaultFetchGroup(java.lang.String dfg)
           
 void setDeleteAction(java.lang.String action)
           
 void setDependent(boolean dependent)
           
 void setDependent(java.lang.String dependent)
           
 void setElementMetaData(ElementMetaData elementMetaData)
          Mutator for the element MetaData
 void setEmbedded(boolean val)
           
 void setEmbedded(java.lang.String val)
           
 void setEmbeddedMetaData(EmbeddedMetaData embeddedMetaData)
          Mutator for the embedded MetaData
 void setFieldTypes(java.lang.String types)
          Mutator for the possible field type(s) that this reference field can store.
 void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
          Mutator for the foreignKey MetaData
 AbstractMemberMetaData setIndexed(IndexedValue val)
           
 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)
           
 void setMappedBy(java.lang.String mappedBy)
           
 void setNotPersistent()
           
 AbstractMemberMetaData setNullValue(NullValue val)
           
 void setOrdered()
          Mutator for whether the collection stored in this field is ordered.
 void setOrderMetaData(OrderMetaData orderMetaData)
          Mutator for the order MetaData
 void setPersistenceModifier(java.lang.String modifier)
           
 AbstractMemberMetaData setPrimaryKey(boolean flag)
           
 AbstractMemberMetaData setPrimaryKey(java.lang.String pk)
           
 void setRecursionDepth(int depth)
           
 void setRecursionDepth(java.lang.String depth)
           
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.
 AbstractMemberMetaData setSchema(java.lang.String schema)
           
 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(boolean flag)
           
 void setSerialised(java.lang.String val)
           
 void setStoreInLob()
          Mutator for whetehr to store as a "lob".
 AbstractMemberMetaData setTable(java.lang.String table)
           
 void setTargetClassName(java.lang.String target)
          Mutator for the target class name.
 void setTransactional()
           
 AbstractMemberMetaData setUnique(boolean unique)
           
 AbstractMemberMetaData setUnique(java.lang.String unique)
           
 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)
           
 void setValueStrategy(java.lang.String strategy)
           
 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, assertIfInitialised, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, isInitialised, isPopulated, isUsed, newExtensionMetaData, removeExtension, setParent, 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 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 java.lang.Boolean cascadePersist
Whether to persist this relation when persisting the owning object.


cascadeUpdate

protected java.lang.Boolean cascadeUpdate
Whether to update this relation when updating the owning object.


cascadeDelete

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


cascadeRefresh

protected java.lang.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.


memberRepresented

protected java.lang.reflect.Member memberRepresented
The member (field/method) being represented here. Note, this prevents Serialization.


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<ColumnMetaData> 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,
                              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)
Constructor for a fields metadata. Set the fields using setters, before populate().

Parameters:
parent - parent MetaData instance TODO Remove this
name - field/property name
Method Detail

populate

public void populate(ClassLoaderResolver clr,
                     java.lang.reflect.Field field,
                     java.lang.reflect.Method method,
                     java.lang.ClassLoader primary,
                     MetaDataManager mmgr)
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)
mmgr - MetaData manager

getDefaultFieldPersistenceModifier

public final FieldPersistenceModifier getDefaultFieldPersistenceModifier(java.lang.Class c,
                                                                         int modifier,
                                                                         boolean isPCclass,
                                                                         MetaDataManager mmgr)
Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a PersistentCapable class.

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

initialise

public void initialise(ClassLoaderResolver clr,
                       MetaDataManager mmgr)
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(MetaDataManager mmgr)
Utility to return if this field is persistable. Not valid for use by the enhancer. Must be overridden for that mode.

Parameters:
mmgr - MetaData manager
Returns:
Whether the field type is persistable.

isFieldArrayTypePersistable

public boolean isFieldArrayTypePersistable(MetaDataManager mmgr)
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.

Parameters:
mmgr - MetaData manager
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()

setValueStrategy

public void setValueStrategy(IdentityStrategy valueStrategy)

setValueStrategy

public void setValueStrategy(java.lang.String 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

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

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()

setLoadFetchGroup

public void setLoadFetchGroup(java.lang.String loadFetchGroup)

getRecursionDepth

public int getRecursionDepth()

setRecursionDepth

public void setRecursionDepth(int depth)

setRecursionDepth

public void setRecursionDepth(java.lang.String depth)

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

getPersistenceModifier

public FieldPersistenceModifier getPersistenceModifier()

setPersistenceModifier

public void setPersistenceModifier(java.lang.String modifier)

setNotPersistent

public void setNotPersistent()

setTransactional

public void setTransactional()

isDefaultFetchGroup

public boolean isDefaultFetchGroup()

setDefaultFetchGroup

public void setDefaultFetchGroup(boolean dfg)

setDefaultFetchGroup

public void setDefaultFetchGroup(java.lang.String dfg)

isDependent

public boolean isDependent()

setDependent

public void setDependent(boolean dependent)

setDependent

public void setDependent(java.lang.String dependent)

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

setEmbedded

public void setEmbedded(java.lang.String val)

setEmbedded

public void setEmbedded(boolean val)

isSerialized

public boolean isSerialized()

setSerialised

public void setSerialised(boolean flag)

setSerialised

public void setSerialised(java.lang.String val)

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()

setPrimaryKey

public AbstractMemberMetaData setPrimaryKey(boolean flag)

setPrimaryKey

public AbstractMemberMetaData setPrimaryKey(java.lang.String pk)

getColumn

public java.lang.String getColumn()

setColumn

public AbstractMemberMetaData setColumn(java.lang.String col)

getTable

public java.lang.String getTable()

setTable

public AbstractMemberMetaData setTable(java.lang.String table)

getCatalog

public java.lang.String getCatalog()

setCatalog

public AbstractMemberMetaData setCatalog(java.lang.String catalog)

getSchema

public java.lang.String getSchema()

setSchema

public AbstractMemberMetaData setSchema(java.lang.String schema)

isUnique

public boolean isUnique()

setUnique

public AbstractMemberMetaData setUnique(java.lang.String unique)

setUnique

public AbstractMemberMetaData setUnique(boolean unique)

getIndexed

public IndexedValue getIndexed()

setIndexed

public AbstractMemberMetaData setIndexed(IndexedValue val)

getNullValue

public NullValue getNullValue()

setNullValue

public AbstractMemberMetaData setNullValue(NullValue val)

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.

setFieldTypes

public void setFieldTypes(java.lang.String types)
Mutator for the possible field type(s) that this reference field can store.

Parameters:
types - The types (comma-separated)

getAbsoluteFieldNumber

public int getAbsoluteFieldNumber()
Accessor for the field id

Returns:
field id

getMemberRepresented

public java.lang.reflect.Member getMemberRepresented()
Accessor for the member being represented.

Returns:
The member

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.

getMappedBy

public final java.lang.String getMappedBy()

setMappedBy

public void setMappedBy(java.lang.String 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.

setDeleteAction

public void setDeleteAction(java.lang.String action)

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

newColumnMetaData

public ColumnMetaData newColumnMetaData()

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

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

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.

newCollectionMetaData

public CollectionMetaData newCollectionMetaData()
Method to create a new collection metadata, set it, and return it.

Returns:
The collection metadata

newArrayMetaData

public ArrayMetaData newArrayMetaData()
Method to create a new array metadata, set it, and return it.

Returns:
The array metadata

newMapMetaData

public MapMetaData newMapMetaData()
Method to create a new map metadata, set it, and return it.

Returns:
The map metadata

setElementMetaData

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

Parameters:
elementMetaData - The elementMetaData to set.

newElementMetaData

public ElementMetaData newElementMetaData()
Method to create a new element metadata, set it, and return it.

Returns:
The element metadata

setKeyMetaData

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

Parameters:
keyMetaData - The keyMetaData to set.

newKeyMetaData

public KeyMetaData newKeyMetaData()
Method to create a new key metadata, set it, and return it.

Returns:
The key metadata

setValueMetaData

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

Parameters:
valueMetaData - The valueMetaData to set.

newValueMetaData

public ValueMetaData newValueMetaData()
Method to create a new value metadata, set it, and return it.

Returns:
The value metadata

setOrderMetaData

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

Parameters:
orderMetaData - The orderMetaData to set.

newOrderMetaData

public OrderMetaData newOrderMetaData()
Method to create a new order metadata, set it, and return it.

Returns:
The order metadata

setEmbeddedMetaData

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

Parameters:
embeddedMetaData - The embeddedMetaData to set.

newEmbeddedMetaData

public EmbeddedMetaData newEmbeddedMetaData()
Method to create a new embedded metadata, set it, and return it.

Returns:
The embedded metadata

setForeignKeyMetaData

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

Parameters:
foreignKeyMetaData - The foreignKeyMetaData to set.

newForeignKeyMetaData

public ForeignKeyMetaData newForeignKeyMetaData()
Method to create a new FK metadata, set it, and return it.

Returns:
The FK metadata

setIndexMetaData

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

Parameters:
indexMetaData - The indexMetaData to set.

newIndexMetaData

public IndexMetaData newIndexMetaData()
Method to create a new index metadata, set it, and return it.

Returns:
The index metadata

setUniqueMetaData

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

Parameters:
uniqueMetaData - The uniqueMetaData to set.

newUniqueMetaData

public UniqueMetaData newUniqueMetaData()
Method to create a new unique metadata, set it, and return it.

Returns:
The unique metadata

setJoinMetaData

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

Parameters:
joinMetaData - The joinMetaData to set.

newJoinMetaData

public JoinMetaData newJoinMetaData()
Method to create a new join metadata, set it, and return it.

Returns:
The join metadata

newJoinMetadata

public JoinMetaData newJoinMetadata()
Method to create a new JoinMetaData, set it, and return it.

Returns:
The join metadata

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,
                                     MetaDataManager mmgr)
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
mmgr - MetaData manager
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. TODO Note that this only applies to 1-1, N-1 fields currently

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(MetaDataManager mmgr)
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


Copyright © 2010. All Rights Reserved.