org.datanucleus.metadata
Class EmbeddedMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.EmbeddedMetaData
All Implemented Interfaces:
java.io.Serializable

public class EmbeddedMetaData
extends MetaData

This element specifies the mapping for an embedded type. It contains multiple field elements, one for each field in the type.

The null-indicator-column optionally identifies the name of the column used to indicate whether the embedded instance is null. By default, if the value of this column is null, then the embedded instance is null. This column might be mapped to a field of the embedded instance but might be a synthetic column for the sole purpose of indicating a null reference. The null-indicator-value specifies the value to indicate that the embedded instance is null. This is only used for non-nullable columns. If null-indicator-column is omitted, then the embedded instance is assumed always to exist.

See Also:
Serialized Form

Field Summary
protected  AbstractMemberMetaData[] fieldMetaData
           
protected  java.util.List members
          Fields/properties of the embedded object.
protected  java.lang.String nullIndicatorColumn
          Name of a column used for determining if the embedded object is null
protected  java.lang.String nullIndicatorValue
          Value in the null column indicating that the embedded object is null
protected  java.lang.String ownerMember
          Name of the owner field/property in the embedded object.
 
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
EmbeddedMetaData()
          Default constructor.
EmbeddedMetaData(EmbeddedMetaData embmd)
          Constructor to create a copy of the passed metadata.
 
Method Summary
 void addMember(AbstractMemberMetaData mmd)
          Method to add a field/property to the embedded definition.
 AbstractMemberMetaData[] getMemberMetaData()
          Accessor for metadata for the embedded members.
 java.lang.String getNullIndicatorColumn()
           
 java.lang.String getNullIndicatorValue()
           
 java.lang.String getOwnerMember()
           
 void initialise(ClassLoaderResolver clr, MetaDataManager mmgr)
          Method to initialise the object, creating all internal convenience arrays.
 FieldMetaData newFieldMetaData(java.lang.String name)
          Method to create a new FieldMetaData, add it, and return it.
 PropertyMetaData newPropertyMetaData(java.lang.String name)
          Method to create a new PropertyMetaData, add it, and return it.
 void populate(ClassLoaderResolver clr, java.lang.ClassLoader primary, MetaDataManager mmgr)
          Method to populate the embedded MetaData.
 EmbeddedMetaData setNullIndicatorColumn(java.lang.String column)
           
 EmbeddedMetaData setNullIndicatorValue(java.lang.String value)
           
 EmbeddedMetaData setOwnerMember(java.lang.String ownerMember)
           
 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

ownerMember

protected java.lang.String ownerMember
Name of the owner field/property in the embedded object.


nullIndicatorColumn

protected java.lang.String nullIndicatorColumn
Name of a column used for determining if the embedded object is null


nullIndicatorValue

protected java.lang.String nullIndicatorValue
Value in the null column indicating that the embedded object is null


members

protected final java.util.List members
Fields/properties of the embedded object.


fieldMetaData

protected AbstractMemberMetaData[] fieldMetaData
Constructor Detail

EmbeddedMetaData

public EmbeddedMetaData(EmbeddedMetaData embmd)
Constructor to create a copy of the passed metadata.

Parameters:
embmd - The metadata to copy

EmbeddedMetaData

public EmbeddedMetaData()
Default constructor. Use setters to set fields, before calling populate().

Method Detail

populate

public void populate(ClassLoaderResolver clr,
                     java.lang.ClassLoader primary,
                     MetaDataManager mmgr)
Method to populate the embedded MetaData. This performs checks on the validity of the field types for embedding.

Parameters:
clr - The class loader to use where necessary
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 all internal convenience arrays.

Overrides:
initialise in class MetaData

getMemberMetaData

public final AbstractMemberMetaData[] getMemberMetaData()
Accessor for metadata for the embedded members.

Returns:
Returns the metadata for any defined members.

getOwnerMember

public final java.lang.String getOwnerMember()

setOwnerMember

public EmbeddedMetaData setOwnerMember(java.lang.String ownerMember)

getNullIndicatorColumn

public final java.lang.String getNullIndicatorColumn()

setNullIndicatorColumn

public EmbeddedMetaData setNullIndicatorColumn(java.lang.String column)

getNullIndicatorValue

public final java.lang.String getNullIndicatorValue()

setNullIndicatorValue

public EmbeddedMetaData setNullIndicatorValue(java.lang.String value)

addMember

public void addMember(AbstractMemberMetaData mmd)
Method to add a field/property to the embedded definition. Rejects the addition of duplicate named fields/properties.

Parameters:
mmd - Meta-Data for the field/property.

newFieldMetaData

public FieldMetaData newFieldMetaData(java.lang.String name)
Method to create a new FieldMetaData, add it, and return it.

Parameters:
name - Name of the field
Returns:
The FieldMetaData

newPropertyMetaData

public PropertyMetaData newPropertyMetaData(java.lang.String name)
Method to create a new PropertyMetaData, add it, and return it.

Parameters:
name - Name of the property
Returns:
The PropertyMetaData

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.


Copyright © 2010. All Rights Reserved.