org.datanucleus.metadata
Class PrimaryKeyMetaData

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

public class PrimaryKeyMetaData
extends MetaData
implements ColumnMetaDataContainer

Representation of a primary key constraint. Can also be used for specifying surrogate keys, but JPOX doesn't support this.

Since:
1.1
Version:
$Revision$
See Also:
Serialized Form

Field Summary
protected  ColumnMetaData[] columnMetaData
          MetaData for columns to be used in PK.
protected  java.lang.String columnName
          Column name of PK.
protected  java.util.List columns
          the columns elements to be included in the index.
protected  java.lang.String name
          PK constraint 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
PrimaryKeyMetaData(MetaData parent, java.lang.String name, java.lang.String columnName)
          Constructor.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 ColumnMetaData[] getColumnMetaData()
          Accessor for columnMetaData
 java.lang.String getName()
          Accessor for PK constraint name.
 void initialise()
          Initialisation method.
 void setName(java.lang.String name)
          Mutator for the name of the PK constraint.
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object using a prefix
 
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

name

protected java.lang.String name
PK constraint name.


columnName

protected java.lang.String columnName
Column name of PK.


columnMetaData

protected ColumnMetaData[] columnMetaData
MetaData for columns to be used in PK.


columns

protected java.util.List columns
the columns elements to be included in the index. Suitable to be empty when this metadata is contained within a field, element, key, value, or join elements

Constructor Detail

PrimaryKeyMetaData

public PrimaryKeyMetaData(MetaData parent,
                          java.lang.String name,
                          java.lang.String columnName)
Constructor.

Parameters:
parent - The parent metadata object
name - Name of the PK constraint
columnName - Name of the column (optional)
Method Detail

initialise

public void initialise()
Initialisation method. This should be called AFTER using the populate method if you are going to use populate. It creates the internal convenience arrays etc needed for normal operation.

Overrides:
initialise in class MetaData

getName

public java.lang.String getName()
Accessor for PK constraint name.

Returns:
Returns the constraint name

setName

public void setName(java.lang.String name)
Mutator for the name of the PK constraint.

Parameters:
name - The name to use

addColumn

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

Specified by:
addColumn in interface ColumnMetaDataContainer
Parameters:
colmd - The ColumnMetaData to add

getColumnMetaData

public final ColumnMetaData[] getColumnMetaData()
Accessor for columnMetaData

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

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object using a prefix

Overrides:
toString in class MetaData
Parameters:
prefix - prefix string
indent - indent string
Returns:
a string representation of the object.


Copyright © 2009. All Rights Reserved.