org.datanucleus.metadata
Class AbstractElementMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.AbstractElementMetaData
All Implemented Interfaces:
java.io.Serializable, ColumnMetaDataContainer
Direct Known Subclasses:
ElementMetaData, KeyMetaData, ValueMetaData

public abstract class AbstractElementMetaData
extends MetaData
implements ColumnMetaDataContainer

This element specifies the mapping for the element component of arrays and collections. If only one column is mapped, and no additional information is needed for the column, then the column attribute can be used. Otherwise, the column element(s) are used. The serialized attribute specifies that the key values are to be serialized into the named column. The foreign-key attribute specifies the name of a foreign key to be generated.

See Also:
Serialized Form

Field Summary
protected  ColumnMetaData[] columnMetaData
           
protected  java.lang.String columnName
          column name value.
protected  java.util.List<ColumnMetaData> columns
          Columns ColumnMetaData
protected  EmbeddedMetaData embeddedMetaData
          EmbeddedMetaData
protected  ForeignKeyMetaData foreignKeyMetaData
          ForeignKeyMetaData
protected  IndexedValue indexed
          The indexing value
protected  IndexMetaData indexMetaData
          IndexMetaData
protected  java.lang.String mappedBy
          Field that this is mapped to.
protected  boolean unique
          Whether to add a unique constraint
protected  UniqueMetaData uniqueMetaData
          UniqueMetaData.
 
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
AbstractElementMetaData()
          Default constructor.
AbstractElementMetaData(AbstractElementMetaData aemd)
          Constructor to create a copy of the passed metadata object.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 ColumnMetaData[] getColumnMetaData()
          Accessor for columnMetaData
 java.lang.String getColumnName()
           
 ForeignKeyAction getDeleteAction()
           
 EmbeddedMetaData getEmbeddedMetaData()
          Accessor for embeddedMetaData
 ForeignKeyMetaData getForeignKeyMetaData()
          Accessor for foreignKeyMetaData
 IndexedValue getIndexed()
           
 IndexMetaData getIndexMetaData()
          Accessor for indexMetaData
 java.lang.String getMappedBy()
           
 UniqueMetaData getUniqueMetaData()
          Accessor for uniqueMetaData
 ForeignKeyAction getUpdateAction()
           
 void initialise(ClassLoaderResolver clr, MetaDataManager mmgr)
          Method to initialise the object, creating any convenience arrays needed.
 boolean isUnique()
           
 ColumnMetaData newColumnMetaData()
          Method to create a column metadata, add it, and return it.
 EmbeddedMetaData newEmbeddedMetaData()
          Method to create an embedded metadata, add it, and return it.
 ForeignKeyMetaData newForeignKeyMetaData()
          Method to create a unique metadata, add it, and return it.
 IndexMetaData newIndexMetaData()
          Method to create an index metadata, add it, and return it.
 UniqueMetaData newUniqueMetaData()
          Method to create a unique metadata, add it, and return it.
 void populate(ClassLoaderResolver clr, java.lang.ClassLoader primary, MetaDataManager mmgr)
          Populate the metadata.
 void setColumnName(java.lang.String columnName)
           
 void setDeleteAction(ForeignKeyAction deleteAction)
           
 void setDeleteAction(java.lang.String deleteAction)
           
 void setEmbeddedMetaData(EmbeddedMetaData embeddedMetaData)
          Mutator for the Embedded MetaData
 void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
          Mutator for the Foreign Key MetaData
 void setIndexed(IndexedValue indexed)
           
 void setIndexMetaData(IndexMetaData indexMetaData)
          Mutator for the Index MetaData
 void setMappedBy(java.lang.String mappedBy)
           
 void setUnique(boolean unique)
           
 void setUnique(java.lang.String unique)
           
 void setUniqueMetaData(UniqueMetaData uniqueMetaData)
          Mutator for the Unique MetaData
 void setUpdateAction(ForeignKeyAction updateAction)
           
 void setUpdateAction(java.lang.String updateAction)
           
 
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtension, assertIfInitialised, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, isInitialised, isPopulated, isUsed, newExtensionMetaData, removeExtension, setParent, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

unique

protected boolean unique
Whether to add a unique constraint


columnName

protected java.lang.String columnName
column name value.


mappedBy

protected java.lang.String mappedBy
Field that this is mapped to.


indexed

protected IndexedValue indexed
The indexing value


indexMetaData

protected IndexMetaData indexMetaData
IndexMetaData


uniqueMetaData

protected UniqueMetaData uniqueMetaData
UniqueMetaData.


foreignKeyMetaData

protected ForeignKeyMetaData foreignKeyMetaData
ForeignKeyMetaData


embeddedMetaData

protected EmbeddedMetaData embeddedMetaData
EmbeddedMetaData


columns

protected final java.util.List<ColumnMetaData> columns
Columns ColumnMetaData


columnMetaData

protected ColumnMetaData[] columnMetaData
Constructor Detail

AbstractElementMetaData

public AbstractElementMetaData(AbstractElementMetaData aemd)
Constructor to create a copy of the passed metadata object.

Parameters:
aemd - The metadata to copy

AbstractElementMetaData

public AbstractElementMetaData()
Default constructor. Set the fields using setters, before populate().

Method Detail

populate

public void populate(ClassLoaderResolver clr,
                     java.lang.ClassLoader primary,
                     MetaDataManager mmgr)
Populate the metadata.

Parameters:
clr - the ClassLoaderResolver
primary - the primary ClassLoader to use (or null)
mmgr - MetaData manager

initialise

public void initialise(ClassLoaderResolver clr,
                       MetaDataManager mmgr)
Method to initialise the object, creating any convenience arrays needed. Initialises all sub-objects.

Overrides:
initialise in class MetaData

getColumnName

public final java.lang.String getColumnName()

setColumnName

public void setColumnName(java.lang.String columnName)

getMappedBy

public java.lang.String getMappedBy()

setMappedBy

public void setMappedBy(java.lang.String mappedBy)

getIndexed

public IndexedValue getIndexed()

setIndexed

public void setIndexed(IndexedValue indexed)

isUnique

public boolean isUnique()

setUnique

public void setUnique(boolean unique)

setUnique

public void setUnique(java.lang.String unique)

getDeleteAction

public ForeignKeyAction getDeleteAction()

setDeleteAction

public void setDeleteAction(java.lang.String deleteAction)

setDeleteAction

public void setDeleteAction(ForeignKeyAction deleteAction)

getUpdateAction

public ForeignKeyAction getUpdateAction()

setUpdateAction

public void setUpdateAction(java.lang.String updateAction)

setUpdateAction

public void setUpdateAction(ForeignKeyAction updateAction)

getColumnMetaData

public final ColumnMetaData[] getColumnMetaData()
Accessor for columnMetaData

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

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.

addColumn

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

Specified by:
addColumn in interface ColumnMetaDataContainer
Parameters:
colmd - The Column MetaData

newColumnMetaData

public ColumnMetaData newColumnMetaData()
Method to create a column metadata, add it, and return it.

Returns:
The column 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 an embedded metadata, add it, and return it.

Returns:
The embedded metadata

setForeignKeyMetaData

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

Parameters:
foreignKeyMetaData - The foreignKeyMetaData to set.

newForeignKeyMetaData

public ForeignKeyMetaData newForeignKeyMetaData()
Method to create a unique metadata, add it, and return it.

Returns:
The unique 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 an index metadata, add 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 unique metadata, add it, and return it.

Returns:
The unique metadata


Copyright © 2011. All Rights Reserved.