Package io.micronaut.data.model
Enum DataType
- java.lang.Object
-
- java.lang.Enum<DataType>
-
- io.micronaut.data.model.DataType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<DataType>
public enum DataType extends java.lang.Enum<DataType>
Enum of basic data types allowing compile time computation which can then subsequently be used at runtime for fast switching.- Since:
- 1.0.0
- Author:
- graemerocher
- See Also:
PersistentProperty.getDataType()
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BIGDECIMAL
A big decimal such asBigDecimal
.BOOLEAN
A boolean value.BOOLEAN_ARRAY
A boolean array.BYTE
A byte.BYTE_ARRAY
A byte array.CHARACTER
A character.CHARACTER_ARRAY
A character array.DATE
A date such asDate
orLocalDate
.DOUBLE
ADouble
value.DOUBLE_ARRAY
A double array.ENTITY
A class annotated withMappedEntity
.FLOAT
AFloat
value.FLOAT_ARRAY
A long array.INTEGER
AInteger
value.INTEGER_ARRAY
An integer array.JSON
A JSON type.LONG
ALong
value.LONG_ARRAY
A long array.OBJECT
An object of an indeterminate type.SHORT
AShort
value.SHORT_ARRAY
A short array.STRING
AString
value.STRING_ARRAY
A string array.TIMESTAMP
A timestamp such asTimestamp
orInstant
.UUID
The UUID type.
-
Field Summary
Fields Modifier and Type Field Description static DataType[]
EMPTY_DATA_TYPE_ARRAY
Empty array of data types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataType
forType(java.lang.Class<?> type)
Obtains the data type for the given type.boolean
isArray()
Is an array type.static DataType
valueOf(java.lang.String name)
Returns 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 Detail
-
BIGDECIMAL
public static final DataType BIGDECIMAL
A big decimal such asBigDecimal
.
-
BOOLEAN
public static final DataType BOOLEAN
A boolean value.
-
BYTE
public static final DataType BYTE
A byte.
-
BYTE_ARRAY
public static final DataType BYTE_ARRAY
A byte array. Often stored as binary.
-
CHARACTER
public static final DataType CHARACTER
A character.
-
DATE
public static final DataType DATE
A date such asDate
orLocalDate
.
-
TIMESTAMP
public static final DataType TIMESTAMP
A timestamp such asTimestamp
orInstant
.
-
DOUBLE
public static final DataType DOUBLE
ADouble
value.
-
FLOAT
public static final DataType FLOAT
AFloat
value.
-
INTEGER
public static final DataType INTEGER
AInteger
value.
-
LONG
public static final DataType LONG
ALong
value.
-
SHORT
public static final DataType SHORT
AShort
value.
-
STRING
public static final DataType STRING
AString
value.
-
OBJECT
public static final DataType OBJECT
An object of an indeterminate type.
-
ENTITY
public static final DataType ENTITY
A class annotated withMappedEntity
.
-
JSON
public static final DataType JSON
A JSON type.
-
UUID
public static final DataType UUID
The UUID type.
-
STRING_ARRAY
public static final DataType STRING_ARRAY
A string array.
-
SHORT_ARRAY
public static final DataType SHORT_ARRAY
A short array.
-
INTEGER_ARRAY
public static final DataType INTEGER_ARRAY
An integer array.
-
LONG_ARRAY
public static final DataType LONG_ARRAY
A long array.
-
FLOAT_ARRAY
public static final DataType FLOAT_ARRAY
A long array.
-
DOUBLE_ARRAY
public static final DataType DOUBLE_ARRAY
A double array.
-
CHARACTER_ARRAY
public static final DataType CHARACTER_ARRAY
A character array.
-
BOOLEAN_ARRAY
public static final DataType BOOLEAN_ARRAY
A boolean array.
-
-
Field Detail
-
EMPTY_DATA_TYPE_ARRAY
public static final DataType[] EMPTY_DATA_TYPE_ARRAY
Empty array of data types.
-
-
Method Detail
-
values
public static DataType[] 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 (DataType c : DataType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DataType 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 namejava.lang.NullPointerException
- if the argument is null
-
isArray
public boolean isArray()
Is an array type.- Returns:
- true if an array type
-
forType
public static DataType forType(@NonNull java.lang.Class<?> type)
Obtains the data type for the given type.- Parameters:
type
- The type- Returns:
- The data type
-
-