Class 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  SchemaUtil.RecordWriter  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SchemaUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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 asString​(Object field)
      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.
    • Constructor Detail

      • SchemaUtil

        private SchemaUtil()
    • Method Detail

      • 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