Class TableFieldDef


  • public class TableFieldDef
    extends Object
    Field definition.

    Value object.

    See Also:
    TableDef
    • Constructor Detail

      • TableFieldDef

        public TableFieldDef​(@NotNull
                             String name,
                             @NotNull
                             TypeDef type,
                             boolean mandatory,
                             boolean serial,
                             boolean defines,
                             boolean refers,
                             @Nullable
                             String def)
        Trivial constructor.
        Parameters:
        name - field name.
        type - data type.
        mandatory - mandatority.
        serial -
        def - default-value expression.
        Since:
        9.0
      • TableFieldDef

        @Deprecated
        public TableFieldDef​(@NotNull
                             String name,
                             @NotNull
                             BaseType type,
                             boolean mandatory,
                             @Nullable
                             String defaultValue)
        Deprecated.
        use #TableFieldDef(String, TypeDef, boolean, boolean, String)
        Old constructor.
        Parameters:
        aDefault -
        name - field name.
        type - data type; can contain macros.
        mandatory - true - mandatory (not null), false - optional (nullable).
      • TableFieldDef

        @Deprecated
        public TableFieldDef​(@NotNull
                             String name,
                             @NotNull
                             BaseType type,
                             int length,
                             boolean mandatory,
                             @Nullable
                             String defaultValue)
        Deprecated.
        use #TableFieldDef(String, TypeDef, boolean, boolean, String)
        Old constructor.
        Parameters:
        name - field name.
        type - data type; can contain macros.
        length - length in characters.
        mandatory - true - mandatory (not null), false - optional (nullable).
        aDefault -
    • Method Detail

      • getName

        @NotNull
        public String getName()
        Field name.
        Returns:
        the field name, in lower case.
      • getType

        @NotNull
        public TypeDef getType()
        Data type.
        Returns:
        data type.
        Since:
        9.0
      • getDomain

        @Nullable
        public DomainDef getDomain()
        Domain, if assigned.
        Returns:
        domain is assigned, or null otherwise.
        Since:
        9.0
      • isDefines

        public boolean isDefines()
        Returns true if the type of the field is a domain (e.g. getDomain() returns non-null value) and the field defines its value.
      • isRefers

        public boolean isRefers()
      • getBaseType

        @NotNull
        public BaseType getBaseType()
        Base type. Can contain macros.
        Returns:
        base type.
      • getLength

        public int getLength()
        Field length, in characters.
        Returns:
        length, in characters.
      • getScale

        public int getScale()
      • isMandatory

        public boolean isMandatory()
        Mandatority.
        Returns:
        true - mandatory (not null), false - optional (nullable).
      • isSerial

        public boolean isSerial()
        Serial: new values for this field are obtained using a kind of sequence. A.k.a. auto-increment.
        Returns:
        true - serial.
        Since:
        9.0
      • getDefault

        @Nullable
        public String getDefault()
        SQL expression for the default value.
        Returns:
        see above.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object