Class SchemaUtil

java.lang.Object
io.debezium.data.SchemaUtil

public class SchemaUtil extends Object
Utilities for obtaining JSON string representations of Schema, Struct, and Field objects.
Author:
Randall Hauch
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    asDetailedString(org.apache.kafka.connect.data.Field field)
    Obtain a JSON string representation of the specified field.
    static String
    asDetailedString(org.apache.kafka.connect.data.Schema schema)
    Obtain a JSON string representation of the specified Schema.
    static String
    asDetailedString(org.apache.kafka.connect.data.Struct struct)
    Obtain a JSON string representation of the specified Struct.
    static String
    asDetailedString(org.apache.kafka.connect.source.SourceRecord record)
    Obtain a JSON string representation of the specified SourceRecord.
    static String
    Obtain a JSON string representation of the specified field.
    static String
    asString(org.apache.kafka.connect.data.Field field)
    Obtain a JSON string representation of the specified field.
    static String
    asString(org.apache.kafka.connect.data.Schema schema)
    Obtain a JSON string representation of the specified Schema.
    static String
    asString(org.apache.kafka.connect.data.Struct struct)
    Obtain a JSON string representation of the specified Struct.
    static String
    asString(org.apache.kafka.connect.source.SourceRecord record)
    Obtain a JSON string representation of the specified SourceRecord.
    static org.apache.kafka.connect.data.SchemaBuilder
    copySchema(org.apache.kafka.connect.data.Schema source)
    Copy all properties to a new schema builder
    getSchemaParameter(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 parameters
    getSourceColumnName(org.apache.kafka.connect.data.Schema schema)
    Extract source column name from connect schema's parameters
    getSourceColumnPrecision(org.apache.kafka.connect.data.Schema schema)
    Extract source column scale from connect schema's parameters
    getSourceColumnSize(org.apache.kafka.connect.data.Schema schema)
    Extract source column length from connect schema's parameters
    getSourceColumnType(org.apache.kafka.connect.data.Schema schema)
    Extract source column type from connect schema's parameters

    Methods inherited from class java.lang.Object

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

    • SchemaUtil

      private SchemaUtil()
  • Method Details

    • asString

      public static String asString(Object field)
      Obtain a JSON string representation of the specified field.
      Parameters:
      field - the field; may not be null
      Returns:
      the JSON string representation
    • asString

      public static String asString(org.apache.kafka.connect.data.Field field)
      Obtain a JSON string representation of the specified field.
      Parameters:
      field - the field; may not be null
      Returns:
      the JSON string representation
    • asString

      public static String asString(org.apache.kafka.connect.data.Struct struct)
      Obtain a JSON string representation of the specified Struct.
      Parameters:
      struct - the Struct; may not be null
      Returns:
      the JSON string representation
    • asString

      public static String asString(org.apache.kafka.connect.data.Schema schema)
      Obtain a JSON string representation of the specified Schema.
      Parameters:
      schema - the Schema; may not be null
      Returns:
      the JSON string representation
    • asString

      public static String asString(org.apache.kafka.connect.source.SourceRecord record)
      Obtain a JSON string representation of the specified SourceRecord.
      Parameters:
      record - the SourceRecord; may not be null
      Returns:
      the JSON string representation
    • asDetailedString

      public static String asDetailedString(org.apache.kafka.connect.data.Field field)
      Obtain a JSON string representation of the specified field.
      Parameters:
      field - the field; may not be null
      Returns:
      the JSON string representation
    • asDetailedString

      public static String asDetailedString(org.apache.kafka.connect.data.Struct struct)
      Obtain a JSON string representation of the specified Struct.
      Parameters:
      struct - the Struct; may not be null
      Returns:
      the JSON string representation
    • asDetailedString

      public static String asDetailedString(org.apache.kafka.connect.data.Schema schema)
      Obtain a JSON string representation of the specified Schema.
      Parameters:
      schema - the Schema; may not be null
      Returns:
      the JSON string representation
    • asDetailedString

      public static String asDetailedString(org.apache.kafka.connect.source.SourceRecord record)
      Obtain a JSON string representation of the specified SourceRecord.
      Parameters:
      record - the SourceRecord; 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

      public static Optional<String> getSourceColumnType(org.apache.kafka.connect.data.Schema schema)
      Extract source column type from connect schema's parameters
      Parameters:
      schema - Connect schema
      Returns:
      the source column type
    • getSourceColumnSize

      public static Optional<String> getSourceColumnSize(org.apache.kafka.connect.data.Schema schema)
      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

      public static Optional<String> getSourceColumnName(org.apache.kafka.connect.data.Schema schema)
      Extract source column name from connect schema's parameters
      Parameters:
      schema - Connect schema
      Returns:
      the source column name
    • getSourceColumnComment

      public static Optional<String> getSourceColumnComment(org.apache.kafka.connect.data.Schema schema)
      Extract source column comment from connect schema's parameters
      Parameters:
      schema - Connect schema
      Returns:
      the source column comment
    • getSchemaParameter

      public static Optional<String> getSchemaParameter(org.apache.kafka.connect.data.Schema schema, String parameterName)