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) instead.
    • 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) instead.
    • useLegacyMappingFor

      @Deprecated public static void useLegacyMappingFor(FieldValueType... fieldValueTypes)
      Deprecated.
      We STRONGLY advise against using the legacy mapping in new projects. Please call useNewMappingFor(STRING, ENUM, TIMESTAMP) 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 legacy applications, call useLegacyMappingFor(STRING, ENUM, TIMESTAMP) before using any YOJ features.
      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 that you call useNewMappingFor(STRING, ENUM, TIMESTAMP) before using any YOJ features. This will eventually become the default mapping, and the call will become a no-op and mighe even be removed.

      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