Enum DataType

java.lang.Object
java.lang.Enum<DataType>
org.apache.empire.data.DataType
All Implemented Interfaces:
Serializable, Comparable<DataType>, java.lang.constant.Constable

public enum DataType extends Enum<DataType>
DataType is an enumeration of data types that are supported with the empire-db component.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    A numeric sequence generated value
    Binary data
    Boolean field (emulated if not supported by DBMS as number or char)
    Fixed length character value.
    Long text > 2K
    Date only value (without time)
    Date including time but without nanoseconds
    Decimal numeric value (size indicates scale and precision)
    floating point value
    Integer value (16, 32 or 64 bit)
    Time only (hh:mm:ss) Might be emulated by a DATE column with a fix date of 1970-01-01
    Timestamp i.e. date including time and nanoseconds.
    Unique Identifier (non-numeric, treated like text)
    Unknown, used internally only for sql phrases
    Variable text (represents varchar)
  • Method Summary

    Modifier and Type
    Method
    Description
    static DataType
    fromJavaType(Class<?> javaType)
    Returns the DataType from a given Java Type If the type is not mapped, then DataType.UNKNOWN is returned
    boolean
    Returns true if the data type is a boolean type
    boolean
    Returns whether or not two DataTypes are compatible
    boolean
    Returns true if the data type is a date based data type (date or datetime)
    boolean
    Returns true if the data type is a numeric data type (integer, decimal, float)
    boolean
    Returns true if the data type is a text based data type (char, text or clob)
    static DataType
    Returns the enum constant of this type with the specified name.
    static DataType[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

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

    • UNKNOWN

      public static final DataType UNKNOWN
      Unknown, used internally only for sql phrases
    • INTEGER

      public static final DataType INTEGER
      Integer value (16, 32 or 64 bit)
    • AUTOINC

      public static final DataType AUTOINC
      A numeric sequence generated value
    • VARCHAR

      public static final DataType VARCHAR
      Variable text (represents varchar)
    • DATE

      public static final DataType DATE
      Date only value (without time)
    • TIME

      public static final DataType TIME
      Time only (hh:mm:ss) Might be emulated by a DATE column with a fix date of 1970-01-01
    • DATETIME

      public static final DataType DATETIME
      Date including time but without nanoseconds
    • TIMESTAMP

      public static final DataType TIMESTAMP
      Timestamp i.e. date including time and nanoseconds. Must be used for the Timestamp column used for optimistic locking
    • CHAR

      public static final DataType CHAR
      Fixed length character value.
    • FLOAT

      public static final DataType FLOAT
      floating point value
    • DECIMAL

      public static final DataType DECIMAL
      Decimal numeric value (size indicates scale and precision)
    • BOOL

      public static final DataType BOOL
      Boolean field (emulated if not supported by DBMS as number or char)
    • CLOB

      public static final DataType CLOB
      Long text > 2K
    • BLOB

      public static final DataType BLOB
      Binary data
    • UNIQUEID

      public static final DataType UNIQUEID
      Unique Identifier (non-numeric, treated like text)
  • Method Details

    • values

      public static DataType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DataType valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isText

      public boolean isText()
      Returns true if the data type is a text based data type (char, text or clob)
      Returns:
      true if the data type is a character based data type
    • isNumeric

      public boolean isNumeric()
      Returns true if the data type is a numeric data type (integer, decimal, float)
      Returns:
      true if the data type is a numeric data type
    • isDate

      public boolean isDate()
      Returns true if the data type is a date based data type (date or datetime)
      Returns:
      true if the data type is a date based data type
    • isBoolean

      public boolean isBoolean()
      Returns true if the data type is a boolean type
      Returns:
      true if the data type is a boolean type
    • isCompatible

      public boolean isCompatible(DataType other)
      Returns whether or not two DataTypes are compatible
      Parameters:
      other - the other one
      Returns:
      true of types are compatible or false otherwise
    • fromJavaType

      public static DataType fromJavaType(Class<?> javaType)
      Returns the DataType from a given Java Type If the type is not mapped, then DataType.UNKNOWN is returned
      Parameters:
      javaType - the Java Type
      Returns:
      the corresponding DataType