Package org.apache.empire.data
Enum DataType
- All Implemented Interfaces:
Serializable,Comparable<DataType>,java.lang.constant.Constable
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 ConstantsEnum ConstantDescriptionA numeric sequence generated valueBinary dataBoolean field (emulated if not supported by DBMS as number or char)Fixed length character value.Long text > 2KDate only value (without time)Date including time but without nanosecondsDecimal numeric value (size indicates scale and precision)floating point valueInteger 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-01Timestamp i.e. date including time and nanoseconds.Unique Identifier (non-numeric, treated like text)Unknown, used internally only for sql phrasesVariable text (represents varchar) -
Method Summary
Modifier and TypeMethodDescriptionstatic DataTypefromJavaType(Class<?> javaType) Returns the DataType from a given Java Type If the type is not mapped, then DataType.UNKNOWN is returnedbooleanReturns true if the data type is a boolean typebooleanisCompatible(DataType other) Returns whether or not two DataTypes are compatiblebooleanisDate()Returns true if the data type is a date based data type (date or datetime)booleanReturns true if the data type is a numeric data type (integer, decimal, float)booleanisText()Returns true if the data type is a text based data type (char, text or clob)static DataTypeReturns the enum constant of this type with the specified name.static DataType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
UNKNOWN
Unknown, used internally only for sql phrases -
INTEGER
Integer value (16, 32 or 64 bit) -
AUTOINC
A numeric sequence generated value -
VARCHAR
Variable text (represents varchar) -
DATE
Date only value (without time) -
TIME
Time only (hh:mm:ss) Might be emulated by a DATE column with a fix date of 1970-01-01 -
DATETIME
Date including time but without nanoseconds -
TIMESTAMP
Timestamp i.e. date including time and nanoseconds. Must be used for the Timestamp column used for optimistic locking -
CHAR
Fixed length character value. -
FLOAT
floating point value -
DECIMAL
Decimal numeric value (size indicates scale and precision) -
BOOL
Boolean field (emulated if not supported by DBMS as number or char) -
CLOB
Long text > 2K -
BLOB
Binary data -
UNIQUEID
Unique Identifier (non-numeric, treated like text)
-
-
Method Details
-
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
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 nameNullPointerException- 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
Returns whether or not two DataTypes are compatible- Parameters:
other- the other one- Returns:
- true of types are compatible or false otherwise
-
fromJavaType
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
-