Enum Class FieldValueType

java.lang.Object
java.lang.Enum<FieldValueType>
tech.ydb.yoj.databind.FieldValueType
All Implemented Interfaces:
Serializable, Comparable<FieldValueType>, Constable

public enum FieldValueType extends Enum<FieldValueType>
Field value type for data binding.
  • Enum Constant Details

    • INTEGER

      public static final FieldValueType INTEGER
      Integer value. Java-side must either be a numeric primitive, or extend java.lang.Number and implement java.lang.Comparable.
    • REAL

      public static final FieldValueType REAL
      Real (floating-point) number value. Java-side must either be a numeric primitive, or extend java.lang.Number and implement java.lang.Comparable.
    • STRING

      public static final FieldValueType STRING
      String value. Java-side must be serialized to simple string value.
    • BOOLEAN

      public static final FieldValueType BOOLEAN
      Boolean value. Java-side must either be an instance of java.lang.Boolean or a boolean primitive.
    • ENUM

      public static final FieldValueType ENUM
      Enum value. Java-side must be an instance of java.lang.Enum.
      Typically stored as enum constant name or its ordinal.
    • TIMESTAMP

      public static final FieldValueType TIMESTAMP
      Timestamp. Java-side must be an instance of java.time.Instant.
    • INTERVAL

      public static final FieldValueType INTERVAL
      Interval. Java-side must be an instance of java.time.Duration.
    • BINARY

      public static final FieldValueType BINARY
      Binary value: just a stream of uninterpreted bytes. Java-side must be a byte array.
    • COMPOSITE

      public static final FieldValueType 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

      public static final FieldValueType 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

      public static final FieldValueType 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

      public static FieldValueType[] 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

      public static FieldValueType valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • registerStringValueType

      public static void registerStringValueType(@NonNull @NonNull Class<?> clazz)
    • forJavaType

      @NonNull public static @NonNull FieldValueType forJavaType(Type type, Column columnAnnotation)
      Detects database field type appropriate for a Java object of type type.
      Parameters:
      type - Java object type
      columnAnnotation - @Column annotation for the field
      Returns:
      database value type
      Throws:
      IllegalArgumentException - if object of this type cannot be mapped to a database value
    • forJavaType

      @NonNull public static @NonNull FieldValueType forJavaType(@NonNull @NonNull Type type)
      Detects database field type appropriate for a Java object of type type.
      Parameters:
      type - Java object type
      Returns:
      database value type
      Throws:
      IllegalArgumentException - if object of this type cannot be mapped to a database value
    • isComposite

      public static boolean isComposite(@NonNull @NonNull Type type)
      Checks whether Java object of type type is mapped to a composite database value (i.e. > 1 database field)
      Parameters:
      type - Java object type
      Returns:
      true if type maps to a composite database value; false otherwise
      Throws:
      IllegalArgumentException - if object of this type cannot be mapped to a database value
      See Also:
    • isComposite

      public boolean isComposite()
      Returns:
      true if this database value type is a composite; false otherwise
    • isUnknown

      public boolean isUnknown()
      Returns:
      true if there is no fitting database value type for the type provided; false otherwise
    • isSortable

      public boolean isSortable()