Class ConnectUnion

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

public class ConnectUnion 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)
    Returns a SchemaBuilder for a Union.
    static Object
    fromLogical(org.apache.kafka.connect.data.Schema schema, org.apache.kafka.connect.data.Struct value)
    Convert a value from its logical format (Union) to it's encoded format.
    static boolean
    isUnion(org.apache.kafka.connect.data.Schema schema)
    Returns whether a schema represents a Union.
    static org.apache.kafka.connect.data.Struct
    toLogical(org.apache.kafka.connect.data.Schema schema, Object value)
    Convert a value from its encoded format to its logical format (Union).
    static org.apache.kafka.connect.data.Struct
    toLogicalUsingName(org.apache.kafka.connect.data.Schema schema, String fieldName, Object value)
    Convert a value from its encoded format to its logical format (Union).

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ConnectUnion

      public ConnectUnion()
  • Method Details

    • builder

      public static org.apache.kafka.connect.data.SchemaBuilder builder(String annotation)
      Returns a SchemaBuilder for a Union.
      Parameters:
      annotation - an arbitrary annotation to be associated with the union
      Returns:
      a SchemaBuilder
    • isUnion

      public static boolean isUnion(org.apache.kafka.connect.data.Schema schema)
      Returns whether a schema represents a Union.
      Parameters:
      schema - the schema
      Returns:
      whether the schema represents a Union
    • fromLogical

      public static Object fromLogical(org.apache.kafka.connect.data.Schema schema, org.apache.kafka.connect.data.Struct value)
      Convert a value from its logical format (Union) to it's encoded format.
      Parameters:
      schema - the schema
      value - the logical value
      Returns:
      the encoded value
    • toLogical

      public static org.apache.kafka.connect.data.Struct toLogical(org.apache.kafka.connect.data.Schema schema, Object value)
      Convert a value from its encoded format to its logical format (Union). The value is associated with the field whose schema matches the given value.
      Parameters:
      schema - the schema
      value - the encoded value
      Returns:
      the logical value
    • toLogicalUsingName

      public static org.apache.kafka.connect.data.Struct toLogicalUsingName(org.apache.kafka.connect.data.Schema schema, String fieldName, Object value)
      Convert a value from its encoded format to its logical format (Union). The value is associated with the field with the given field name.
      Parameters:
      schema - the schema
      fieldName - the field name
      value - the encoded value
      Returns:
      the logical value