Enum SchemaType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<SchemaType>

    @Public
    @Stable
    public enum SchemaType
    extends java.lang.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 Detail

      • 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 Detail

      • values

        public static SchemaType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SchemaType c : SchemaType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SchemaType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

        public int getValue()
      • valueOf

        public static SchemaType valueOf​(int value)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.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)