Enum Class SchemaType

java.lang.Object
java.lang.Enum<SchemaType>
org.apache.pulsar.common.schema.SchemaType
所有已实现的接口:
Serializable, Comparable<SchemaType>, Constable

@Public @Stable public enum SchemaType extends Enum<SchemaType>
Types of supported schema for Pulsar messages.

Ideally we should have just one single set of enum definitions for schema type. but we have 3 locations of defining schema types.

when you are adding a new schema type that whose schema info is required to be recorded in schema registry, add corresponding schema type into `pulsar-common/src/main/proto/PulsarApi.proto` and `pulsar-broker/src/main/proto/SchemaRegistryFormat.proto`.

  • 枚举常量详细资料

    • NONE

      public static final SchemaType NONE
      No schema defined.
    • STRING

      public static final SchemaType STRING
      Simple String encoding with UTF-8.
    • JSON

      public static final SchemaType JSON
      JSON object encoding and validation.
    • PROTOBUF

      public static final SchemaType PROTOBUF
      Protobuf message encoding and decoding.
    • AVRO

      public static final SchemaType AVRO
      Serialize and deserialize via avro.
    • BOOLEAN

      public static final SchemaType BOOLEAN
      boolean schema defined.
      从以下版本开始:
      2.3.0
    • INT8

      public static final SchemaType INT8
      A 8-byte integer.
    • INT16

      public static final SchemaType INT16
      A 16-byte integer.
    • INT32

      public static final SchemaType INT32
      A 32-byte integer.
    • INT64

      public static final SchemaType INT64
      A 64-byte integer.
    • FLOAT

      public static final SchemaType FLOAT
      A float number.
    • DOUBLE

      public static final SchemaType DOUBLE
      A double number.
    • DATE

      public static final SchemaType DATE
      Date.
      从以下版本开始:
      2.4.0
    • TIME

      public static final SchemaType TIME
      Time.
      从以下版本开始:
      2.4.0
    • TIMESTAMP

      public static final SchemaType TIMESTAMP
      Timestamp.
      从以下版本开始:
      2.4.0
    • KEY_VALUE

      public static final SchemaType KEY_VALUE
      A Schema that contains Key Schema and Value Schema.
    • INSTANT

      public static final SchemaType INSTANT
      Instant.
    • LOCAL_DATE

      public static final SchemaType LOCAL_DATE
      LocalDate.
    • LOCAL_TIME

      public static final SchemaType LOCAL_TIME
      LocalTime.
    • LOCAL_DATE_TIME

      public static final SchemaType LOCAL_DATE_TIME
      LocalDateTime.
    • PROTOBUF_NATIVE

      public static final SchemaType PROTOBUF_NATIVE
      Protobuf native schema base on Descriptor.
    • BYTES

      public static final SchemaType BYTES
      A bytes array.
    • AUTO

      @Deprecated public static final SchemaType AUTO
      已过时。
      Auto Detect Schema Type.
    • AUTO_CONSUME

      public static final SchemaType AUTO_CONSUME
      Auto Consume Type.
    • AUTO_PUBLISH

      public static final SchemaType AUTO_PUBLISH
      Auto Publish Type.
  • 方法详细资料

    • values

      public static SchemaType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      返回:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SchemaType 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.)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - 如果参数为空值
    • getValue

      public int getValue()
    • valueOf

      public static SchemaType valueOf(int value)
      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.)
      参数:
      value - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - 如果参数为空值
    • isPrimitive

      public boolean isPrimitive()
    • isStruct

      public boolean isStruct()
    • isPrimitiveType

      public static boolean isPrimitiveType(SchemaType type)
    • isStructType

      public static boolean isStructType(SchemaType type)