Enum ForeignKeyAction

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ForeignKeyAction>

    public enum ForeignKeyAction
    extends java.lang.Enum<ForeignKeyAction>
    Enum for foreign key actions.
    Author:
    harald
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CASCADE
      When the primary key is updated, the foreign key (imported key) is changed to agree with it.
      INITIALLY_DEFERRED
      Indicates deferrability.
      INITIALLY_IMMEDIATE
      Indicates deferrability.
      NO_ACTION
      If the primary key has been imported, it cannot be updated or deleted.
      NOT_DEFERRABLE
      Indicates deferrability.
      RESTRICT
      The primary key may not be updated if it has been imported by another table as a foreign key.
      SET_DEFAULT
      If the primary key is updated or deleted, the foreign key (imported key) is set to the default value.
      SET_NULL
      When the primary key is updated or deleted, the foreign key (imported key) is changed to NULL..
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ForeignKeyAction createFromAction​(int action)
      Creates a foreign key action from an action code.
      int getAction()
      Gets the action code.
      java.lang.String getSql()
      Gets the SQL code.
      java.lang.String toString()  
      static ForeignKeyAction valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ForeignKeyAction[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • CASCADE

        public static final ForeignKeyAction CASCADE
        When the primary key is updated, the foreign key (imported key) is changed to agree with it.
      • RESTRICT

        public static final ForeignKeyAction RESTRICT
        The primary key may not be updated if it has been imported by another table as a foreign key.
      • SET_NULL

        public static final ForeignKeyAction SET_NULL
        When the primary key is updated or deleted, the foreign key (imported key) is changed to NULL..
      • NO_ACTION

        public static final ForeignKeyAction NO_ACTION
        If the primary key has been imported, it cannot be updated or deleted.
      • SET_DEFAULT

        public static final ForeignKeyAction SET_DEFAULT
        If the primary key is updated or deleted, the foreign key (imported key) is set to the default value.
      • INITIALLY_DEFERRED

        public static final ForeignKeyAction INITIALLY_DEFERRED
        Indicates deferrability. See SQL-92 for a definition.
      • INITIALLY_IMMEDIATE

        public static final ForeignKeyAction INITIALLY_IMMEDIATE
        Indicates deferrability. See SQL-92 for a definition.
      • NOT_DEFERRABLE

        public static final ForeignKeyAction NOT_DEFERRABLE
        Indicates deferrability. See SQL-92 for a definition.
    • Method Detail

      • values

        public static ForeignKeyAction[] 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 (ForeignKeyAction c : ForeignKeyAction.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ForeignKeyAction 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 name
        java.lang.NullPointerException - if the argument is null
      • getAction

        public int getAction()
        Gets the action code.
        Returns:
        the action code
      • getSql

        public java.lang.String getSql()
        Gets the SQL code.
        Returns:
        the sql
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<ForeignKeyAction>
      • createFromAction

        public static ForeignKeyAction createFromAction​(int action)
        Creates a foreign key action from an action code.
        Parameters:
        action - the code
        Returns:
        the foreign key action, null if invalid code