- All Implemented Interfaces:
Serializable,Comparable<ForeignKeyAction>,Constable
Enum for foreign key actions.
- Author:
- harald
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionWhen the primary key is updated, the foreign key (imported key) is changed to agree with it.Indicates deferrability.Indicates deferrability.If the primary key has been imported, it cannot be updated or deleted.Indicates deferrability.The primary key may not be updated if it has been imported by another table as a foreign key.If the primary key is updated or deleted, the foreign key (imported key) is set to the default value.When the primary key is updated or deleted, the foreign key (imported key) is changed toNULL.. -
Method Summary
Modifier and TypeMethodDescriptionstatic ForeignKeyActioncreateFromAction(int action) Creates a foreign key action from an action code.intGets the action code.getSql()Gets the SQL code.toString()static ForeignKeyActionReturns the enum constant of this class with the specified name.static ForeignKeyAction[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CASCADE
When the primary key is updated, the foreign key (imported key) is changed to agree with it. -
RESTRICT
The primary key may not be updated if it has been imported by another table as a foreign key. -
SET_NULL
When the primary key is updated or deleted, the foreign key (imported key) is changed toNULL.. -
NO_ACTION
If the primary key has been imported, it cannot be updated or deleted. -
SET_DEFAULT
If the primary key is updated or deleted, the foreign key (imported key) is set to the default value. -
INITIALLY_DEFERRED
Indicates deferrability. See SQL-92 for a definition. -
INITIALLY_IMMEDIATE
Indicates deferrability. See SQL-92 for a definition. -
NOT_DEFERRABLE
Indicates deferrability. See SQL-92 for a definition.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getAction
public int getAction()Gets the action code.- Returns:
- the action code
-
getSql
Gets the SQL code.- Returns:
- the sql
-
toString
- Overrides:
toStringin classEnum<ForeignKeyAction>
-
createFromAction
Creates a foreign key action from an action code.- Parameters:
action- the code- Returns:
- the foreign key action, null if invalid code
-