Package tech.ydb.yoj.databind
Enum Class FieldValueType
- All Implemented Interfaces:
Serializable,Comparable<FieldValueType>,Constable
Field value type for data binding.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBinary value: just a stream of uninterpreted bytes.Boolean value.Composite value.Enum value.Integer value.Interval.Polymorphic object stored in an opaque form (i.e., individual fields cannot be accessed by data binding).
Serialized form strongly depends on the the marshalling mechanism (e.g., JSON, YAML, ...).Real (floating-point) number value.String value.Timestamp.Value type is unknown.
It might be supported by the data binding implementation, but relying on that fact is not recommended. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull FieldValueTypeforJavaType(@NonNull Type type) Detects database field type appropriate for a Java object of typetype.static @NonNull FieldValueTypeforJavaType(Type type, Column columnAnnotation) Detects database field type appropriate for a Java object of typetype.booleanstatic booleanisComposite(@NonNull Type type) Checks whether Java object of typetypeis mapped to a composite database value (i.e.booleanbooleanstatic voidregisterStringValueType(@NonNull Class<?> clazz) static FieldValueTypeReturns the enum constant of this class with the specified name.static FieldValueType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INTEGER
Integer value. Java-side must either be a numeric primitive, or extendjava.lang.Numberand implementjava.lang.Comparable. -
REAL
Real (floating-point) number value. Java-side must either be a numeric primitive, or extendjava.lang.Numberand implementjava.lang.Comparable. -
STRING
String value. Java-side must be serialized to simple string value. -
BOOLEAN
Boolean value. Java-side must either be an instance ofjava.lang.Booleanor abooleanprimitive. -
ENUM
Enum value. Java-side must be an instance ofjava.lang.Enum.
Typically stored asenum constant nameor itsordinal. -
TIMESTAMP
Timestamp. Java-side must be an instance ofjava.time.Instant. -
INTERVAL
Interval. Java-side must be an instance ofjava.time.Duration. -
BINARY
Binary value: just a stream of uninterpreted bytes. Java-side must be a byte array. -
COMPOSITE
Composite value. Can contain any other values, including other composite values.
Java-side must be an immutable POJO with all-args constructor, e.g. a Lombok@Value-annotated class. -
OBJECT
Polymorphic object stored in an opaque form (i.e., individual fields cannot be accessed by data binding).
Serialized form strongly depends on the the marshalling mechanism (e.g., JSON, YAML, ...). -
UNKNOWN
Value type is unknown.
It might be supported by the data binding implementation, but relying on that fact is not recommended.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
registerStringValueType
-
forJavaType
Detects database field type appropriate for a Java object of typetype.- Parameters:
type- Java object typecolumnAnnotation-@Columnannotation for the field- Returns:
- database value type
- Throws:
IllegalArgumentException- if object of this type cannot be mapped to a database value
-
forJavaType
Detects database field type appropriate for a Java object of typetype.- Parameters:
type- Java object type- Returns:
- database value type
- Throws:
IllegalArgumentException- if object of this type cannot be mapped to a database value
-
isComposite
Checks whether Java object of typetypeis mapped to a composite database value (i.e. > 1 database field)- Parameters:
type- Java object type- Returns:
trueiftypemaps to a composite database value;falseotherwise- Throws:
IllegalArgumentException- if object of this type cannot be mapped to a database value- See Also:
-
isComposite
public boolean isComposite()- Returns:
trueif this database value type is a composite;falseotherwise
-
isUnknown
public boolean isUnknown()- Returns:
trueif there is no fitting database value type for the type provided;falseotherwise
-
isSortable
public boolean isSortable()
-