Class ConnectEnum

java.lang.Object
io.confluent.connect.schema.ConnectEnum

public class ConnectEnum extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.kafka.connect.data.SchemaBuilder
    builder(String annotation, List<String> symbols)
    Returns a SchemaBuilder for an Enum.
    static org.apache.kafka.connect.data.SchemaBuilder
    builder(String annotation, Map<String,Integer> symbols)
    Returns a SchemaBuilder for an Enum.
    static <T extends Enum<T>>
    String
    fromLogical(org.apache.kafka.connect.data.Schema schema, T value)
    Convert a value from its logical format (Enum) to its encoded format.
    static boolean
    hasEnumSymbol(org.apache.kafka.connect.data.Schema schema, String symbol)
    Returns whether a schema has an Enum symbol.
    static boolean
    isEnum(org.apache.kafka.connect.data.Schema schema)
    Returns whether a schema represents an Enum.
    static <T extends Enum<T>>
    T
    toLogical(org.apache.kafka.connect.data.Schema schema, Class<T> cls, String symbol)
    Convert a value from its encoded format to its logical format (Enum).
    static int
    toOrdinal(org.apache.kafka.connect.data.Schema schema, String symbol)
    Convert a value from its encoded format to its ordinal.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ConnectEnum

      public ConnectEnum()
  • Method Details

    • builder

      public static org.apache.kafka.connect.data.SchemaBuilder builder(String annotation, List<String> symbols)
      Returns a SchemaBuilder for an Enum.
      Parameters:
      annotation - an arbitrary annotation to be associated with the enum
      symbols - the enum symbols
      Returns:
      a SchemaBuilder
    • builder

      public static org.apache.kafka.connect.data.SchemaBuilder builder(String annotation, Map<String,Integer> symbols)
      Returns a SchemaBuilder for an Enum.
      Parameters:
      annotation - an arbitrary annotation to be associated with the enum
      symbols - a map of enum symbol to its ordinal
      Returns:
      a SchemaBuilder
    • isEnum

      public static boolean isEnum(org.apache.kafka.connect.data.Schema schema)
      Returns whether a schema represents an Enum.
      Parameters:
      schema - the schema
      Returns:
      whether the schema represents an Enum
    • hasEnumSymbol

      public static boolean hasEnumSymbol(org.apache.kafka.connect.data.Schema schema, String symbol)
      Returns whether a schema has an Enum symbol.
      Parameters:
      schema - the schema
      symbol - the enum symbol
      Returns:
      whether the schema represents an Enum
    • fromLogical

      public static <T extends Enum<T>> String fromLogical(org.apache.kafka.connect.data.Schema schema, T value)
      Convert a value from its logical format (Enum) to its encoded format.
      Parameters:
      schema - the schema
      value - the logical value
      Returns:
      the encoded value
    • toLogical

      public static <T extends Enum<T>> T toLogical(org.apache.kafka.connect.data.Schema schema, Class<T> cls, String symbol)
      Convert a value from its encoded format to its logical format (Enum).
      Parameters:
      schema - the schema
      cls - the class of the logical value
      symbol - the enum symbol
      Returns:
      the logical value
    • toOrdinal

      public static int toOrdinal(org.apache.kafka.connect.data.Schema schema, String symbol)
      Convert a value from its encoded format to its ordinal.
      Parameters:
      schema - the schema
      symbol - the enum symbol
      Returns:
      the ordinal