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.

Since:
1.1
Version:
$Revision: 1.42 $
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(MetaData parent, EmbeddedMetaData embmd)
          Constructor to create a copy of the passed metadata using the provided parent.
EmbeddedMetaData(MetaData parent, java.lang.String ownerField, java.lang.String nullColumn, java.lang.String nullValue)
          Constructor.
 
Method Summary
 void addMember(AbstractMemberMetaData mmd)
          Method to add a field/property to the embedded definition.
 AbstractMemberMetaData[] getFieldMetaData()
          Accessor for fieldMetaData
 java.lang.String getNullIndicatorColumn()
          Accessor for the column to check for null values.
 java.lang.String getNullIndicatorValue()
          Accessor for the value of the null indicator column when null
 java.lang.String getOwnerMember()
          Accessor for the owner field/property to contain the FK back to the owner
 void initialise()
          Method to initialise the object, creating all internal convenience arrays.
 void populate(ClassLoaderResolver clr, java.lang.ClassLoader primary)
          Method to populate the embedded MetaData.
 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

members

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


ownerMember

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


nullIndicatorColumn

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


nullIndicatorValue

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


fieldMetaData

protected AbstractMemberMetaData[] fieldMetaData
Constructor Detail

EmbeddedMetaData

public EmbeddedMetaData(MetaData parent,
                        EmbeddedMetaData embmd)
Constructor to create a copy of the passed metadata using the provided parent.

Parameters:
parent - The parent
embmd - The metadata to copy

EmbeddedMetaData

public EmbeddedMetaData(MetaData parent,
                        java.lang.String ownerField,
                        java.lang.String nullColumn,
                        java.lang.String nullValue)
Constructor.

Parameters:
parent - Owning metadata
ownerField - The owner field
nullColumn - Column to use for determining null embedded object
nullValue - Value of column to use for determining null embedded object
Method Detail

populate

public void populate(ClassLoaderResolver clr,
                     java.lang.ClassLoader primary)
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)

initialise

public void initialise()
Method to initialise the object, creating all internal convenience arrays.

Overrides:
initialise in class MetaData

getFieldMetaData

public final AbstractMemberMetaData[] getFieldMetaData()
Accessor for fieldMetaData

Returns:
Returns the fieldMetaData.

getOwnerMember

public final java.lang.String getOwnerMember()
Accessor for the owner field/property to contain the FK back to the owner

Returns:
The owner field/property

getNullIndicatorColumn

public final java.lang.String getNullIndicatorColumn()
Accessor for the column to check for null values.

Returns:
The column name

getNullIndicatorValue

public final java.lang.String getNullIndicatorValue()
Accessor for the value of the null indicator column when null

Returns:
The 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.

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 © 2009. All Rights Reserved.