Class YqlPrimitiveType

java.lang.Object
tech.ydb.yoj.repository.ydb.yql.YqlPrimitiveType
All Implemented Interfaces:
YqlType

public class YqlPrimitiveType extends Object implements YqlType
  • Constructor Details

    • YqlPrimitiveType

      public YqlPrimitiveType()
  • Method Details

    • changeStringDefaultTypeToUtf8

      @Deprecated(forRemoval=true) public static void changeStringDefaultTypeToUtf8()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method will be removed in YOJ 3.0.0. Call useNewMappingFor(STRING, ENUM, UUID) instead, if you wish to map Strings, Enums and UUIDs to UTF8 (TEXT) YDB column type (i.e., UTF-8 encoded text).
    • resetStringDefaultTypeToDefaults

      @Deprecated(forRemoval=true) public static void resetStringDefaultTypeToDefaults()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method has a misleading name and will be removed in YOJ 3.0.0. Call useLegacyMappingFor(STRING, ENUM, UUID) instead, if you wish to map Strings, Enums and UUIDs to STRING (BYTES) YDB column type (i.e., a byte array).
    • useLegacyMappingFor

      @Deprecated public static void useLegacyMappingFor(FieldValueType... fieldValueTypes)
      Deprecated.
      We STRONGLY advise against using the legacy mapping in new projects. Please call useNewMappingFor(FieldValueType.values()) instead, and annotate custom-mapped columns with @Column where a different mapping is desired.
      Uses the legacy (YOJ 1.0.x) field value type ↔ YDB column type mapping for the specified field value type(s).

      If you need to support a wide range of legacy applications, call useLegacyMappingFor(FieldValueType.values()) before using any YOJ features.

      You can apply the legacy mapping partially, e.g. useLegacyMappingFor(STRING, ENUM, UUID) to map String, Enums and UUIDs to STRING (BYTES) YDB column type (i.e., a byte array).

      Parameters:
      fieldValueTypes - field value types to use legacy mapping for
    • useRecommendedMappingFor

      public static void useRecommendedMappingFor(FieldValueType... fieldValueTypes)
      Uses the recommended field value type ↔ YDB column type mapping for the specified field value type(s).

      In new projects, we STRONGLY advise you to call useNewMappingFor(FieldValueType.values()) before using any YOJ features. This will eventually become the default mapping, and this call will become a no-op and might even be removed in a future version of YOJ.

      You can apply the new mapping partially, e.g. useNewMappingFor(STRING, ENUM, UUID) to map String, Enums and UUIDs to UTF8 (TEXT) YDB column type (i.e., UTF-8 encoded text).

      Parameters:
      fieldValueTypes - field value types to use the new mapping for
    • of

      @NonNull @Deprecated(forRemoval=true) public static @NonNull YqlPrimitiveType of(Type javaType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method will be removed in YOJ 3.0.0. Nothing in YOJ calls YqlPrimitiveType.of(Type) any more.

      Please use YqlPrimitiveType.of(JavaField) because it correcly respects the customizations specified in the @Column and @CustomValueType annotations.

    • of

      @NonNull public static @NonNull YqlPrimitiveType of(Schema.JavaField column)
      Returns the Yql type of the column.

      If the Column annotation is specified for the column field, the annotation field dbType may be used to specify the column type.

      Returns:
      the Yql type of the column
    • getYqlTypeName

      public String getYqlTypeName()
      Specified by:
      getYqlTypeName in interface YqlType
    • getYqlTypeBuilder

      public tech.ydb.proto.ValueProtos.Type.Builder getYqlTypeBuilder()
      Specified by:
      getYqlTypeBuilder in interface YqlType
    • toYql

      public tech.ydb.proto.ValueProtos.Value.Builder toYql(Object value)
      Specified by:
      toYql in interface YqlType
    • fromYql

      public Object fromYql(tech.ydb.proto.ValueProtos.Value value)
      Specified by:
      fromYql in interface YqlType