org.datanucleus.metadata
Class FieldMetaData

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

public class FieldMetaData
extends AbstractMemberMetaData

Representation of the Meta-Data for a field of a class.

Lifecycle state

An object of this type has 2 lifecycle states. The first is the raw constructed object which represents pure MetaData (maybe from a MetaData file). The second is a "populated" object which represents MetaData for a Field of a class with the metadata aligned to be appropriate for that Field.

Containers

Each field can represent a container. The container can be an array, a Collection or a Map. The field type must be of the correct type to represent these.

JPOX Management

Each field can be managed by JPOX or not. The class provides a method for identifying if a field is managed by JPOX (isJdoField()). If a field is managed by JPOX, it will have a field "id" (within its class). In a class the field "id" will start at 0 (for the first field, in alphabetical order).

MetaData Element

The MetaData element represented here is as follows
 
 <!ELEMENT field (extension*, (collection|map|array|(column*))?, join?, element?, 
      key?, value?, fetch-group*, order?, embedded?, index?, unique?, foreign-key?,
      delete-action?, extension*)?>
 <!ATTLIST field name CDATA #REQUIRED>
 <!ATTLIST field persistence-modifier (persistent|transactional|none)
      #IMPLIED>
 <!ATTLIST field table CDATA #IMPLIED>
 <!ATTLIST field null-value (exception|default|none) 'none'>
 <!ATTLIST field default-fetch-group (true|false) #IMPLIED>
 <!ATTLIST field embedded (true|false) #IMPLIED>
 <!ATTLIST field serialized (true|false) #IMPLIED>
 <!ATTLIST field dependent (true|false) #IMPLIED>
 <!ATTLIST field indexed (true|false|unique) #IMPLIED>
 <!ATTLIST field unique (true|false) #IMPLIED>
 <!ATTLIST field load-fetch-group CDATA #IMPLIED>
 <!ATTLIST field recursion-depth CDATA #IMPLIED>
 <!ATTLIST field primary-key (true|false) 'false'>
 <!ATTLIST field mapped-by CDATA #IMPLIED>
 <!ATTLIST field value-strategy CDATA #IMPLIED>
 <!ATTLIST field delete-action (restrict|cascade|null|default|none) #IMPLIED>
 <!ATTLIST field sequence CDATA #IMPLIED>
 <!ATTLIST field field-type CDATA #IMPLIED>
 

Since:
1.1
Version:
$Revision: 1.83 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.datanucleus.metadata.AbstractMemberMetaData
cacheable, cascadeDelete, cascadePersist, cascadeRefresh, cascadeUpdate, catalog, className, column, columnMetaData, columns, container, DEFAULT_RECURSION_DEPTH, defaultFetchGroup, dependent, elementMetaData, embedded, embeddedMetaData, fieldId, fieldTypes, foreignKeyMetaData, fullFieldName, indexed, indexMetaData, jdoFieldFlag, joinMetaData, keyMetaData, loadFetchGroup, mappedBy, modifiers, name, nullValue, ordered, orderMetaData, persistenceModifier, primaryKey, recursionDepth, relatedMemberMetaData, relationType, schema, sequence, serialized, storeInLob, table, targetClassName, type, UNDEFINED_RECURSION_DEPTH, uniqueConstraint, uniqueMetaData, valueGeneratorName, valueMetaData, valueStrategy
 
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
FieldMetaData(MetaData parent, AbstractMemberMetaData fmd)
          Convenience constructor to copy the specification from the passed field.
FieldMetaData(MetaData parent, java.lang.String name)
          Convenience constructor taking defaults
FieldMetaData(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
 int compareTo(java.lang.Object o)
          Comparator method.
 boolean isProperty()
          Whether this uses getter/setter accessors (Property) or used field based access (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.AbstractMemberMetaData
addColumn, calcIsSecondClassMutable, fieldBelongsToClass, getAbsoluteFieldNumber, getAbstractClassMetaData, getArray, getCatalog, getClassName, getClassName, getCollection, getColumn, getColumnMetaData, getContainer, getDefaultFieldPersistenceModifier, getElementMetaData, getEmbeddedMetaData, getFieldId, getFieldTypes, getForeignKeyMetaData, getFullFieldName, getIndexMetaData, getJdoFieldFlag, getJoinMetaData, getKeyMetaData, getLoadFetchGroup, getMap, getMappedBy, getMetaDataManager, getName, getNullValue, getOrderMetaData, getOverallParentClassMetaData, getPersistenceModifier, getRecursionDepth, getRelatedMemberMetaData, getRelatedMemberMetaDataForObject, getRelationType, getSchema, getSequence, getTable, getType, getTypeName, getUniqueMetaData, getValueGeneratorName, getValueMetaData, getValueStrategy, hasArray, hasCollection, hasContainer, hasMap, initialise, isAbstract, isCacheable, isCascadeDelete, isCascadePersist, isCascadeRefresh, isCascadeUpdate, isDefaultFetchGroup, isDependent, isEmbedded, isFieldArrayTypePersistable, isFieldTypePersistable, isFinal, isJdoField, isPersistentInterface, isPrimaryKey, isPrivate, isProtected, isPublic, isRelationOwner, isSerialized, isStatic, isTransient, populate, setCacheable, setCascadeDelete, setCascadePersist, setCascadeRefresh, setCascadeUpdate, setCatalog, setContainer, setDefaultFetchGroup, setDependent, setElementMetaData, setEmbeddedMetaData, setForeignKeyMetaData, setIndexMetaData, setJoinMetaData, setKeyMetaData, setLoadFetchGroup, setMappedBy, setNotPersistent, setOrdered, setOrderMetaData, setPrimaryKey, setRelation, setSchema, setSequence, setSerialised, setStoreInLob, setTable, setTargetClassName, setTransactional, setUniqueMetaData, setValueGeneratorName, setValueMetaData, setValueStrategy
 
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
 

Constructor Detail

FieldMetaData

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

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

FieldMetaData

public FieldMetaData(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

FieldMetaData

public FieldMetaData(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

isProperty

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

Specified by:
isProperty in class AbstractMemberMetaData
Returns:
true if this is a property

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 AbstractMemberMetaData
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
Overrides:
compareTo in class AbstractMemberMetaData
Parameters:
o - The object to compare against
Returns:
The comparison result


Copyright © 2009. All Rights Reserved.