org.datanucleus.metadata
Class AbstractConstraintMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.AbstractConstraintMetaData
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ForeignKeyMetaData, IndexMetaData, UniqueMetaData

public class AbstractConstraintMetaData
extends MetaData

Abstract representation of an ORM constraint.

See Also:
Serialized Form

Field Summary
protected  ColumnMetaData[] columnMetaData
          Contains the metadata for columns
protected  java.util.List<ColumnMetaData> columns
          The columns for this constraint.
protected  AbstractMemberMetaData[] memberMetaData
          Contains the metadata for fields/properties.
protected  java.util.List<AbstractMemberMetaData> members
          The fields/properties for this constraint.
protected  java.lang.String name
          the constraint name
protected  java.lang.String table
          the constraint table name.
 
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
AbstractConstraintMetaData()
          Default constructor.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 void addMember(AbstractMemberMetaData mmd)
          Add a new member that is part of this constraint.
 ColumnMetaData[] getColumnMetaData()
          Accessor for columnMetaData
 AbstractMemberMetaData[] getMemberMetaData()
          Accessor for metadata for all fields/properties that this constraint relates to.
 int getNumberOfColumns()
          Accessor for the number of columns for this constraint.
 int getNumberOfMembers()
          Accessor for the number of fields/properties for this constraint.
 void initialise(ClassLoaderResolver clr, MetaDataManager mmgr)
          Method to initialise the object, creating internal convenience arrays.
 ColumnMetaData newColumnMetaData()
          Method to create a new column, add it, and return it.
 FieldMetaData newFieldMetaData(java.lang.String name)
          Method to create a new field, add it, and return it.
 PropertyMetaData newPropertyMetaData(java.lang.String name)
          Method to create a new property, add it, and return it.
 
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

name

protected java.lang.String name
the constraint name


table

protected java.lang.String table
the constraint table name. Name of the table to which this applies (null implies the enclosing class' table).


memberMetaData

protected AbstractMemberMetaData[] memberMetaData
Contains the metadata for fields/properties.


columnMetaData

protected ColumnMetaData[] columnMetaData
Contains the metadata for columns


members

protected java.util.List<AbstractMemberMetaData> members
The fields/properties for this constraint.


columns

protected java.util.List<ColumnMetaData> columns
The columns for this constraint.

Constructor Detail

AbstractConstraintMetaData

public AbstractConstraintMetaData()
Default constructor. Set fields using setters before populate().

Method Detail

initialise

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

Overrides:
initialise in class MetaData

addMember

public void addMember(AbstractMemberMetaData mmd)
Add a new member that is part of this constraint.

Parameters:
mmd - MetaData for the field/property

newFieldMetaData

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

Returns:
The field metadata

newPropertyMetaData

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

Returns:
The property metadata

addColumn

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

Parameters:
colmd - MetaData for the column

newColumnMetaData

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

Returns:
The column metadata

getMemberMetaData

public final AbstractMemberMetaData[] getMemberMetaData()
Accessor for metadata for all fields/properties that this constraint relates to.

Returns:
Returns the memberMetaData.

getColumnMetaData

public final ColumnMetaData[] getColumnMetaData()
Accessor for columnMetaData

Returns:
Returns the columnMetaData.

getNumberOfMembers

public int getNumberOfMembers()
Accessor for the number of fields/properties for this constraint.

Returns:
Number of fields/properties

getNumberOfColumns

public int getNumberOfColumns()
Accessor for the number of columns for this constraint.

Returns:
Number of columns


Copyright © 2011. All Rights Reserved.