Package io.debezium.data
Class SchemaUtil
java.lang.Object
io.debezium.data.SchemaUtil
Utilities for obtaining JSON string representations of
Schema, Struct, and Field objects.- Author:
- Randall Hauch
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasDetailedString(org.apache.kafka.connect.data.Field field) Obtain a JSON string representation of the specified field.static StringasDetailedString(org.apache.kafka.connect.data.Schema schema) Obtain a JSON string representation of the specifiedSchema.static StringasDetailedString(org.apache.kafka.connect.data.Struct struct) Obtain a JSON string representation of the specifiedStruct.static StringasDetailedString(org.apache.kafka.connect.source.SourceRecord record) Obtain a JSON string representation of the specifiedSourceRecord.static StringObtain a JSON string representation of the specified field.static StringasString(org.apache.kafka.connect.data.Field field) Obtain a JSON string representation of the specified field.static StringasString(org.apache.kafka.connect.data.Schema schema) Obtain a JSON string representation of the specifiedSchema.static StringasString(org.apache.kafka.connect.data.Struct struct) Obtain a JSON string representation of the specifiedStruct.static StringasString(org.apache.kafka.connect.source.SourceRecord record) Obtain a JSON string representation of the specifiedSourceRecord.static org.apache.kafka.connect.data.SchemaBuildercopySchema(org.apache.kafka.connect.data.Schema source) Copy all properties to a new schema buildergetSchemaParameter(org.apache.kafka.connect.data.Schema schema, String parameterName) getSourceColumnComment(org.apache.kafka.connect.data.Schema schema) Extract source column comment from connect schema's parametersgetSourceColumnName(org.apache.kafka.connect.data.Schema schema) Extract source column name from connect schema's parametersgetSourceColumnPrecision(org.apache.kafka.connect.data.Schema schema) Extract source column scale from connect schema's parametersgetSourceColumnSize(org.apache.kafka.connect.data.Schema schema) Extract source column length from connect schema's parametersgetSourceColumnType(org.apache.kafka.connect.data.Schema schema) Extract source column type from connect schema's parameters
-
Constructor Details
-
SchemaUtil
private SchemaUtil()
-
-
Method Details
-
asString
Obtain a JSON string representation of the specified field.- Parameters:
field- the field; may not be null- Returns:
- the JSON string representation
-
asString
Obtain a JSON string representation of the specified field.- Parameters:
field- the field; may not be null- Returns:
- the JSON string representation
-
asString
Obtain a JSON string representation of the specifiedStruct.- Parameters:
struct- theStruct; may not be null- Returns:
- the JSON string representation
-
asString
Obtain a JSON string representation of the specifiedSchema.- Parameters:
schema- theSchema; may not be null- Returns:
- the JSON string representation
-
asString
Obtain a JSON string representation of the specifiedSourceRecord.- Parameters:
record- theSourceRecord; may not be null- Returns:
- the JSON string representation
-
asDetailedString
Obtain a JSON string representation of the specified field.- Parameters:
field- the field; may not be null- Returns:
- the JSON string representation
-
asDetailedString
Obtain a JSON string representation of the specifiedStruct.- Parameters:
struct- theStruct; may not be null- Returns:
- the JSON string representation
-
asDetailedString
Obtain a JSON string representation of the specifiedSchema.- Parameters:
schema- theSchema; may not be null- Returns:
- the JSON string representation
-
asDetailedString
Obtain a JSON string representation of the specifiedSourceRecord.- Parameters:
record- theSourceRecord; may not be null- Returns:
- the JSON string representation
-
copySchema
public static org.apache.kafka.connect.data.SchemaBuilder copySchema(org.apache.kafka.connect.data.Schema source) Copy all properties to a new schema builder- Parameters:
source- Connect schema- Returns:
- Connect schema build
-
getSourceColumnType
Extract source column type from connect schema's parameters- Parameters:
schema- Connect schema- Returns:
- the source column type
-
getSourceColumnSize
Extract source column length from connect schema's parameters- Parameters:
schema- Connect schema- Returns:
- the source column length
-
getSourceColumnPrecision
public static Optional<String> getSourceColumnPrecision(org.apache.kafka.connect.data.Schema schema) Extract source column scale from connect schema's parameters- Parameters:
schema- Connect schema- Returns:
- the source column scale
-
getSourceColumnName
Extract source column name from connect schema's parameters- Parameters:
schema- Connect schema- Returns:
- the source column name
-
getSourceColumnComment
Extract source column comment from connect schema's parameters- Parameters:
schema- Connect schema- Returns:
- the source column comment
-
getSchemaParameter
-