Package io.confluent.connect.schema
Class ConnectUnion
java.lang.Object
io.confluent.connect.schema.ConnectUnion
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilderReturns a SchemaBuilder for a Union.static ObjectfromLogical(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 booleanisUnion(org.apache.kafka.connect.data.Schema schema) Returns whether a schema represents a Union.static org.apache.kafka.connect.data.StructConvert a value from its encoded format to its logical format (Union).static org.apache.kafka.connect.data.StructtoLogicalUsingName(org.apache.kafka.connect.data.Schema schema, String fieldName, Object value) Convert a value from its encoded format to its logical format (Union).
-
Field Details
-
LOGICAL_PARAMETER
- See Also:
-
-
Constructor Details
-
ConnectUnion
public ConnectUnion()
-
-
Method Details
-
builder
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 schemavalue- 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 schemavalue- 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 schemafieldName- the field namevalue- the encoded value- Returns:
- the logical value
-