org.brains2b.sql.meta
Class IndexModel

java.lang.Object
  extended by org.brains2b.sql.meta.IndexModel
All Implemented Interfaces:
SQLMetaModel

public class IndexModel
extends java.lang.Object
implements SQLMetaModel

Wrapper around the index definition from DatabaseMetaData

Class is read-only, use SquelerDDL:IndexDDL for changing columns

Version:
1.01 [26-10-2007]
Author:
dennis@brains2b.nl
See Also:
SQLMetaData, SQLRecord

Constructor Summary
protected IndexModel()
          Constructor only used by IndexDDL
  IndexModel(SQLRecord record)
          Create an IndexModel on the basis of this SQLRecord
 
Method Summary
protected  void addColumn(ColumnModel model)
          add a ColumnModel as a part of this IndexModel
 boolean equals(java.lang.Object obj)
           
 java.util.List getColumns()
          get the columns involved in this Index
 java.lang.String getName()
          get the name for this model's instance
 SQLRecord getRecord()
          the record which defines all the values for the model
 java.lang.String getTableName()
          get the table for this index
 java.lang.String getType()
          get the type of Object defined by the meta model
 boolean isUnique()
          check if this is an unique index
protected  void setColumns(java.util.List columns)
          set the columns for this Model
protected  void setRecord(SQLRecord record)
          set the record for this Model
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexModel

protected IndexModel()
Constructor only used by IndexDDL


IndexModel

public IndexModel(SQLRecord record)
Create an IndexModel on the basis of this SQLRecord

Parameters:
record - SQLRecord, the record containing the information on this column
Method Detail

getName

public java.lang.String getName()
get the name for this model's instance

This is equal to the name of the table,column, etc.

Specified by:
getName in interface SQLMetaModel
Returns:
String

getRecord

public SQLRecord getRecord()
the record which defines all the values for the model

Specified by:
getRecord in interface SQLMetaModel
Returns:
SQLRecord

getType

public java.lang.String getType()
get the type of Object defined by the meta model

returned value depends on the model: TABLE,COLUMN,INDEX

Specified by:
getType in interface SQLMetaModel
Returns:
String

getColumns

public java.util.List getColumns()
get the columns involved in this Index

Returns:
List of ColumnModel

setColumns

protected void setColumns(java.util.List columns)
set the columns for this Model

Parameters:
columns - List

getTableName

public java.lang.String getTableName()
get the table for this index

Returns:
String

isUnique

public boolean isUnique()
check if this is an unique index

Returns:
boolean

addColumn

protected void addColumn(ColumnModel model)
add a ColumnModel as a part of this IndexModel

Parameters:
model - ColumnModel

setRecord

protected void setRecord(SQLRecord record)
set the record for this Model

Parameters:
record - SQLRecord

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object