org.jpox.metadata
Class IndexMetaData

java.lang.Object
  extended byorg.jpox.metadata.MetaData
      extended byorg.jpox.metadata.ExtendableMetaData
          extended byorg.jpox.metadata.IndexMetaData
All Implemented Interfaces:
ColumnMetaDataContainer, java.io.Serializable

public class IndexMetaData
extends ExtendableMetaData
implements ColumnMetaDataContainer

For schema generation, it might be useful to specify that a column or columns be indexed, and to provide the name of the index. For this purpose, an index element can be contained within a field, element, key, value, or join element, and this indicates that the column(s) associated with the referenced element should be indexed. Indexes can also be specified at the class level, by including index elements containing column elements. In this case, the column elements are mapped elsewhere, and the column elements contain only the column name.

MetaData Element

The MetaData Element represented here is as follows
 <!ELEMENT index (extension*, (column|field|property)*, extension*)>
 <!ATTLIST index name CDATA #IMPLIED>
 <!ATTLIST index table CDATA #IMPLIED>
 <!ATTLIST index unique (true|false) `false'>
 

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

Field Summary
protected  ColumnMetaData[] columnMetaData
          Contains the metadata for columns
protected  java.util.List columns
          the columns elements to be included in the index.
protected  AbstractPropertyMetaData[] fieldMetaData
          Contains the metadata for fields
protected  java.util.List fields
          the field elements to be included in the index.
 
Fields inherited from class org.jpox.metadata.ExtendableMetaData
extensions, JPOX_VENDOR_NAME
 
Fields inherited from class org.jpox.metadata.MetaData
LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent
 
Constructor Summary
IndexMetaData(MetaData parent, IndexMetaData imd)
          Constructor to create a copy of the passed metadata using the provided parent.
IndexMetaData(java.lang.String name, java.lang.String table, java.lang.String unique)
          Constructor.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 void addField(AbstractPropertyMetaData fmd)
          Add a new AbstractPropertyMetaData element
 ColumnMetaData[] getColumnMetaData()
          Accessor for columnMetaData
 AbstractPropertyMetaData[] getFieldMetaData()
          Accessor for fieldMetaData
 java.lang.String getName()
          Accessor for the name of the index.
 java.lang.String getTable()
          Accessor for the table
 void initialise()
          Method to initialise the object, creating internal convenience arrays.
 java.lang.Boolean isUnique()
          Accessor for whether the index is unique
 java.lang.String toString()
          Returns a string representation of the object.
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object.
 
Methods inherited from class org.jpox.metadata.ExtendableMetaData
addExtension, addExtension, getExtension, getExtensions, getNoOfExtensions, getValueForExtension, getValuesForExtension, getValuesForExtensionStartingWith, hasExtension, removeExtension
 
Methods inherited from class org.jpox.metadata.MetaData
getParent, isCreated, isInitialised, isPopulated, isUsed, populate, setInitialised, setPopulated, setUsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fieldMetaData

protected AbstractPropertyMetaData[] fieldMetaData
Contains the metadata for fields


columnMetaData

protected ColumnMetaData[] columnMetaData
Contains the metadata for columns


fields

protected java.util.List fields
the field elements to be included in the index. Can be empty.


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

IndexMetaData

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

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

IndexMetaData

public IndexMetaData(java.lang.String name,
                     java.lang.String table,
                     java.lang.String unique)
Constructor.

Parameters:
name - Name of index
table - Name of the table
unique - Whether it is unique.
Method Detail

initialise

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

Overrides:
initialise in class MetaData

addField

public void addField(AbstractPropertyMetaData fmd)
Add a new AbstractPropertyMetaData element

Parameters:
fmd - The AbstractPropertyMetaData to add

addColumn

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

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

getFieldMetaData

public final AbstractPropertyMetaData[] getFieldMetaData()
Accessor for fieldMetaData

Returns:
Returns the fieldMetaData.

getColumnMetaData

public final ColumnMetaData[] getColumnMetaData()
Accessor for columnMetaData

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

getName

public final java.lang.String getName()
Accessor for the name of the index.

Returns:
Returns the name.

getTable

public final java.lang.String getTable()
Accessor for the table

Returns:
Returns the table..

isUnique

public final java.lang.Boolean isUnique()
Accessor for whether the index is unique

Returns:
Returns whether the index is unique.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class ExtendableMetaData
Returns:
a string representation of the object.

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object. This can be used as part of a facility to output a MetaData file.

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


Copyright © -2007 . All Rights Reserved.