Package edu.caltech.nanodb.relations
Enum TableConstraintType
- java.lang.Object
-
- java.lang.Enum<TableConstraintType>
-
- edu.caltech.nanodb.relations.TableConstraintType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<TableConstraintType>
public enum TableConstraintType extends java.lang.Enum<TableConstraintType>
An enumeration specifying the constraint types allowed on tables.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FOREIGN_KEY
Values in the column or columns reference a key in another table.NOT_NULL
Values in a column may not be null.PRIMARY_KEY
The column or set of columns is the table's primary key.UNIQUE
Values in a column or set of columns must be unique.
-
Field Summary
Fields Modifier and Type Field Description private byte
typeID
The ID of the constraint type.
-
Constructor Summary
Constructors Modifier Constructor Description private
TableConstraintType(int typeID)
Construct a new TableConstraintType instance with the specified type ID.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TableConstraintType
findType(byte typeID)
Given the specified ID, this method returns the corresponding constraint type enum value, or it returnsnull
if the type value doesn't signify any constraint type in this enumeration.byte
getTypeID()
Returns the constraint type's unique ID.boolean
isUnique()
static TableConstraintType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TableConstraintType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NOT_NULL
public static final TableConstraintType NOT_NULL
Values in a column may not be null.
-
UNIQUE
public static final TableConstraintType UNIQUE
Values in a column or set of columns must be unique.
-
PRIMARY_KEY
public static final TableConstraintType PRIMARY_KEY
The column or set of columns is the table's primary key.
-
FOREIGN_KEY
public static final TableConstraintType FOREIGN_KEY
Values in the column or columns reference a key in another table.
-
-
Constructor Detail
-
TableConstraintType
private TableConstraintType(int typeID)
Construct a new TableConstraintType instance with the specified type ID. Each constraint type should have a unique ID. Note that this constructor is private, since this is the only place where table constraint types should be declared.
-
-
Method Detail
-
values
public static TableConstraintType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TableConstraintType c : TableConstraintType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TableConstraintType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getTypeID
public byte getTypeID()
Returns the constraint type's unique ID.
-
isUnique
public boolean isUnique()
-
findType
public static TableConstraintType findType(byte typeID)
Given the specified ID, this method returns the corresponding constraint type enum value, or it returnsnull
if the type value doesn't signify any constraint type in this enumeration.
-
-