net.sf.jso.sql
Class ConstraintDescriptor

java.lang.Object
  extended bynet.sf.jso.sql.ConstraintDescriptor
All Implemented Interfaces:
java.io.Serializable

public class ConstraintDescriptor
extends java.lang.Object
implements java.io.Serializable

Class for constraint descritptors. Constraint descriptors represent constraints of a table in a relational database.

See Also:
Serialized Form

Field Summary
static int ALTERNATE_KEY
          Constant for the alternate key constraint type.
static int FOREING_KEY
          Constant for the foreing key constraint type.
static int INDEX
          Constant for the index constraint type.
static int NULL
          Constant for the null constraint type.
static int PRIMARY_KEY
          Constant for the primary key constraint type.
static int UNIQUE_INDEX
          Constant for the unique index constraint type.
 
Constructor Summary
ConstraintDescriptor()
          Constructs the constraint descriptor.
ConstraintDescriptor(java.lang.String aName, int aType, java.util.List aFieldList)
          Constructs the constraint descriptor.
ConstraintDescriptor(java.lang.String aName, int aType, java.util.List aFieldList, java.lang.String aRefTable, java.util.List aRefFieldList)
          Constructs the constraint descriptor.
ConstraintDescriptor(java.lang.String aName, int aType, java.lang.String[] aFieldArray)
          Constructs the constraint descriptor.
ConstraintDescriptor(java.lang.String aName, int aType, java.lang.String[] aFieldArray, java.lang.String aRefTable, java.lang.String[] aRefFieldArray)
          Constructs the constraint descriptor.
 
Method Summary
 void addField(java.lang.String aField)
          Adds a field to the constraint.
 void addFields(java.util.List aFieldList)
          Adds a list of fields to this constraint's fields list.
 void addFields(java.lang.String[] aFieldArray)
          Adds an array of fields to this constraint's fields list.
 void addRefField(java.lang.String aField)
          Adds a referenced field to the constraint.
 void addRefFields(java.util.List aFieldList)
          Adds a list of fields to this constraint's referenced fields list.
 void addRefFields(java.lang.String[] aFieldArray)
          Adds an arrayt of fields to this constraint's referenced fields list.
 void clearFields()
          Clears the constraint's list of fields.
 void clearRefFields()
          Clears the constraint's list of referenced fields.
 boolean equals(java.lang.Object o)
          Indicates whether some other constraint descriptor is "equal to" this one.
 java.util.List getFields()
          Gets the constraint's list of fields.
 java.lang.String getName()
          Gets constraint's name.
 java.util.List getRefFields()
          Gets the constraint's list of referenced fields.
 java.lang.String getRefTable()
          Gets constraint's referenced table name.
 int getType()
          Gets constraint's type.
 int hashCode()
          Returns a hash code value for the constraint descriptor.
 void removeField(java.lang.String aField)
          Removes a field from the constraint.
 void removeRefField(java.lang.String aField)
          Removes a referenced field from the constraint.
 void setName(java.lang.String aName)
          Sets constraint's name.
 void setRefTable(java.lang.String aName)
          Sets constraint's referenced table name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final int NULL
Constant for the null constraint type.

See Also:
Constant Field Values

PRIMARY_KEY

public static final int PRIMARY_KEY
Constant for the primary key constraint type.

See Also:
Constant Field Values

INDEX

public static final int INDEX
Constant for the index constraint type.

See Also:
Constant Field Values

UNIQUE_INDEX

public static final int UNIQUE_INDEX
Constant for the unique index constraint type.

See Also:
Constant Field Values

FOREING_KEY

public static final int FOREING_KEY
Constant for the foreing key constraint type.

See Also:
Constant Field Values

ALTERNATE_KEY

public static final int ALTERNATE_KEY
Constant for the alternate key constraint type.

See Also:
Constant Field Values
Constructor Detail

ConstraintDescriptor

public ConstraintDescriptor()
Constructs the constraint descriptor.


ConstraintDescriptor

public ConstraintDescriptor(java.lang.String aName,
                            int aType,
                            java.util.List aFieldList)
                     throws java.lang.IllegalArgumentException
Constructs the constraint descriptor.

Parameters:
aName - A name for the constraint.
aType - A type for the constraint.
aFieldList - List of fields for the constraint.

ConstraintDescriptor

public ConstraintDescriptor(java.lang.String aName,
                            int aType,
                            java.lang.String[] aFieldArray)
                     throws java.lang.IllegalArgumentException
Constructs the constraint descriptor.

Parameters:
aName - A name for the constraint.
aType - A type for the constraint.
aFieldArray - Array of fields for the constraint.

ConstraintDescriptor

public ConstraintDescriptor(java.lang.String aName,
                            int aType,
                            java.util.List aFieldList,
                            java.lang.String aRefTable,
                            java.util.List aRefFieldList)
                     throws java.lang.IllegalArgumentException
Constructs the constraint descriptor.

Parameters:
aName - A name for the constraint.
aType - A type for the constraint.
aFieldList - List of fields for the constraint.
aRefTable - A table referenced by the constraint.
aRefFieldList - List of fields referenced by the constraint.

ConstraintDescriptor

public ConstraintDescriptor(java.lang.String aName,
                            int aType,
                            java.lang.String[] aFieldArray,
                            java.lang.String aRefTable,
                            java.lang.String[] aRefFieldArray)
                     throws java.lang.IllegalArgumentException
Constructs the constraint descriptor.

Parameters:
aName - A name for the constraint.
aType - A type for the constraint.
aFieldArray - Array of fields for the constraint.
aRefTable - A table referenced by the constraint.
aRefFieldArray - Array of fields referenced by the constraint.
Method Detail

setName

public void setName(java.lang.String aName)
Sets constraint's name.

Parameters:
aName - A name for the constraint.

getName

public java.lang.String getName()
Gets constraint's name.

Returns:
constraint's name.

getType

public int getType()
Gets constraint's type.

Returns:
constraint's type.

addField

public void addField(java.lang.String aField)
Adds a field to the constraint.

Parameters:
aField - The field to be added.

removeField

public void removeField(java.lang.String aField)
Removes a field from the constraint.

Parameters:
aField - The field to be removed.

addFields

public void addFields(java.util.List aFieldList)
Adds a list of fields to this constraint's fields list.

Parameters:
aFieldList - List of fields to be added.

addFields

public void addFields(java.lang.String[] aFieldArray)
Adds an array of fields to this constraint's fields list.

Parameters:
aFieldArray - Array of fields to be added.

clearFields

public void clearFields()
Clears the constraint's list of fields.


getFields

public java.util.List getFields()
Gets the constraint's list of fields.

Returns:
A list of strings.

setRefTable

public void setRefTable(java.lang.String aName)
Sets constraint's referenced table name.

Parameters:
aName - The referenced table.

getRefTable

public java.lang.String getRefTable()
Gets constraint's referenced table name.

Returns:
The referenced table name.

addRefField

public void addRefField(java.lang.String aField)
Adds a referenced field to the constraint.

Parameters:
aField - The referenced field to be added.

removeRefField

public void removeRefField(java.lang.String aField)
Removes a referenced field from the constraint.

Parameters:
aField - The referenced field to be removed.

addRefFields

public void addRefFields(java.util.List aFieldList)
Adds a list of fields to this constraint's referenced fields list.

Parameters:
aFieldList - List of fields to be added.

addRefFields

public void addRefFields(java.lang.String[] aFieldArray)
Adds an arrayt of fields to this constraint's referenced fields list.

Parameters:
aFieldArray - Array of fields to be added.

clearRefFields

public void clearRefFields()
Clears the constraint's list of referenced fields.


getRefFields

public java.util.List getRefFields()
Gets the constraint's list of referenced fields.

Returns:
A list of strings.

equals

public boolean equals(java.lang.Object o)
Indicates whether some other constraint descriptor is "equal to" this one.

Parameters:
o - The object with which to compare.
Returns:
true if the constraint descriptor is the same as the constraint descriptor argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the constraint descriptor.

Returns:
A hash code value for the constraint descriptor.