Class EmbeddedMetaData

java.lang.Object
org.datanucleus.metadata.MetaData
org.datanucleus.metadata.EmbeddedMetaData
All Implemented Interfaces:
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 nullIndicatorColumn 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 nullIndicatorValue specifies the value to indicate that the embedded instance is null. This is only used for non-nullable columns. If nullIndicatorColumn is omitted, then the embedded instance is assumed always to exist.

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • ownerMember

      protected String ownerMember
      Name of the field/property in the embedded object that refers to the owner (bidirectional relation).
    • nullIndicatorColumn

      protected String nullIndicatorColumn
      Name of a column used for determining if the embedded object is null
    • nullIndicatorValue

      protected String nullIndicatorValue
      Value in the null column indicating that the embedded object is null
    • discriminatorMetaData

      protected DiscriminatorMetaData discriminatorMetaData
      Discriminator for use when embedding objects with inheritance.
    • members

      protected final List<AbstractMemberMetaData> members
      Member definition of the embedded object.
  • Constructor Details

    • 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 Details

    • populate

      public void populate(ClassLoaderResolver clr, 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(ClassLoaderResolver clr)
      Method to initialise the object, creating all internal convenience arrays.
      Overrides:
      initialise in class MetaData
      Parameters:
      clr - ClassLoader resolver
    • getMemberMetaData

      public final List<AbstractMemberMetaData> getMemberMetaData()
      Accessor for metadata for the embedded members.
      Returns:
      Returns the metadata for any defined members.
    • getOwnerMember

      public final String getOwnerMember()
    • setOwnerMember

      public EmbeddedMetaData setOwnerMember(String ownerMember)
    • getNullIndicatorColumn

      public final String getNullIndicatorColumn()
    • setNullIndicatorColumn

      public EmbeddedMetaData setNullIndicatorColumn(String column)
    • getNullIndicatorValue

      public final String getNullIndicatorValue()
    • setNullIndicatorValue

      public EmbeddedMetaData setNullIndicatorValue(String value)
    • getDiscriminatorMetaData

      public final DiscriminatorMetaData getDiscriminatorMetaData()
    • setDiscriminatorMetaData

      public EmbeddedMetaData setDiscriminatorMetaData(DiscriminatorMetaData dismd)
    • newDiscriminatorMetaData

      public DiscriminatorMetaData newDiscriminatorMetaData()
      Method to create a new discriminator metadata, assign it to this inheritance, and return it.
      Returns:
      The discriminator metadata
    • addMember

      public void addMember(AbstractMemberMetaData mmd)
      Method to add a member to the embedded definition. Rejects the addition of duplicate named members, or when we have already initialised this embedded definition.
      Parameters:
      mmd - Meta-Data for the member
    • newFieldMetaData

      public FieldMetaData newFieldMetaData(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(String name)
      Method to create a new PropertyMetaData, add it, and return it.
      Parameters:
      name - Name of the property
      Returns:
      The PropertyMetaData
    • toString

      public String toString()
      Overrides:
      toString in class Object