Enum Class SchemaType

java.lang.Object
java.lang.Enum<SchemaType>
org.apache.pulsar.common.schema.SchemaType
All Implemented Interfaces:
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`.

  • Enum Constant Details

    • 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.
      Since:
      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.
      Since:
      2.4.0
    • TIME

      public static final SchemaType TIME
      Time.
      Since:
      2.4.0
    • TIMESTAMP

      public static final SchemaType TIMESTAMP
      Timestamp.
      Since:
      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
      Deprecated.
      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.
  • Method Details

    • values

      public static SchemaType[] 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 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.)
      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
    • 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.)
      Parameters:
      value - 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
    • isPrimitive

      public boolean isPrimitive()
    • isStruct

      public boolean isStruct()
    • isPrimitiveType

      public static boolean isPrimitiveType(SchemaType type)
    • isStructType

      public static boolean isStructType(SchemaType type)