java.lang.Object
io.confluent.kafka.schemaregistry.maven.derive.schema.DeriveSchema
Direct Known Subclasses:
DeriveAvroSchema, DeriveJsonSchema, DeriveProtobufSchema

public abstract class DeriveSchema extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final HashMap<String,String>
     
    protected static final com.fasterxml.jackson.databind.ObjectMapper
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected abstract com.fasterxml.jackson.databind.JsonNode
    convertToFormat(com.fasterxml.jackson.databind.JsonNode schema, String name)
     
    protected com.fasterxml.jackson.databind.JsonNode
     
    Optional<com.fasterxml.jackson.databind.JsonNode>
    getPrimitiveSchema(com.fasterxml.jackson.databind.JsonNode field)
     
    com.fasterxml.jackson.databind.node.ObjectNode
    getSchemaForArray(List<com.fasterxml.jackson.databind.JsonNode> messages, String name)
    Generate schema for array in json format, this schema is used as template by other formats
    com.fasterxml.jackson.databind.node.ObjectNode
    getSchemaForMultipleMessages(List<com.fasterxml.jackson.databind.JsonNode> messages)
     
    com.fasterxml.jackson.databind.node.ObjectNode
    getSchemaForRecord(com.fasterxml.jackson.databind.node.ObjectNode message)
    Generate schema for record in json format, this schema is used as template by other formats
    protected List<com.fasterxml.jackson.databind.JsonNode>
    getSchemaOfAllElements(List<com.fasterxml.jackson.databind.JsonNode> messages, String name)
     
    protected void
    getSingleDataType(com.fasterxml.jackson.databind.node.ObjectNode mergedArray, com.fasterxml.jackson.databind.node.ArrayNode items)
     
    com.fasterxml.jackson.databind.node.ObjectNode
    mergeArrays(List<com.fasterxml.jackson.databind.JsonNode> arrayList, boolean useItems, boolean check2dArray)
    Merging different field types of array into one type
    protected abstract com.fasterxml.jackson.databind.node.ObjectNode
    mergeMultipleDataTypes(com.fasterxml.jackson.databind.node.ObjectNode mergedArray, List<com.fasterxml.jackson.databind.JsonNode> primitives, List<com.fasterxml.jackson.databind.JsonNode> records, List<com.fasterxml.jackson.databind.JsonNode> arrays, boolean check2dArray)
     
    protected abstract com.fasterxml.jackson.databind.node.ArrayNode
    mergeMultipleMessages(List<com.fasterxml.jackson.databind.JsonNode> uniqueSchemas, Map<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ArrayNode> schemaToIndex)
     
    com.fasterxml.jackson.databind.node.ObjectNode
    mergeRecords(List<com.fasterxml.jackson.databind.JsonNode> recordList)
    Merge fields in all the records together into one record
    protected void
    updateSchemaInformation(com.fasterxml.jackson.databind.JsonNode mergedSchema, com.fasterxml.jackson.databind.node.ArrayNode messagesMatched, com.fasterxml.jackson.databind.node.ArrayNode schemaInformationList)
     

    Methods inherited from class java.lang.Object

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

    • classToDataType

      protected final HashMap<String,String> classToDataType
    • mapper

      protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
    • PRIMITIVE_SCHEMA_TYPE

      public static final String PRIMITIVE_SCHEMA_TYPE
      See Also:
  • Constructor Details

    • DeriveSchema

      public DeriveSchema()
  • Method Details

    • getSchemaOfAllElements

      protected List<com.fasterxml.jackson.databind.JsonNode> getSchemaOfAllElements(List<com.fasterxml.jackson.databind.JsonNode> messages, String name) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • checkName

      protected void checkName(String name)
    • getPrimitiveSchema

      public Optional<com.fasterxml.jackson.databind.JsonNode> getPrimitiveSchema(com.fasterxml.jackson.databind.JsonNode field)
    • getSchemaForArray

      public com.fasterxml.jackson.databind.node.ObjectNode getSchemaForArray(List<com.fasterxml.jackson.databind.JsonNode> messages, String name) throws com.fasterxml.jackson.core.JsonProcessingException
      Generate schema for array in json format, this schema is used as template by other formats
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getSchemaForRecord

      public com.fasterxml.jackson.databind.node.ObjectNode getSchemaForRecord(com.fasterxml.jackson.databind.node.ObjectNode message) throws com.fasterxml.jackson.core.JsonProcessingException
      Generate schema for record in json format, this schema is used as template by other formats
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • mergeRecords

      public com.fasterxml.jackson.databind.node.ObjectNode mergeRecords(List<com.fasterxml.jackson.databind.JsonNode> recordList)
      Merge fields in all the records together into one record
    • mergeArrays

      public com.fasterxml.jackson.databind.node.ObjectNode mergeArrays(List<com.fasterxml.jackson.databind.JsonNode> arrayList, boolean useItems, boolean check2dArray)
      Merging different field types of array into one type
    • getNullSchema

      protected com.fasterxml.jackson.databind.JsonNode getNullSchema()
    • getSchemaForMultipleMessages

      public com.fasterxml.jackson.databind.node.ObjectNode getSchemaForMultipleMessages(List<com.fasterxml.jackson.databind.JsonNode> messages) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • updateSchemaInformation

      protected void updateSchemaInformation(com.fasterxml.jackson.databind.JsonNode mergedSchema, com.fasterxml.jackson.databind.node.ArrayNode messagesMatched, com.fasterxml.jackson.databind.node.ArrayNode schemaInformationList)
    • getSingleDataType

      protected void getSingleDataType(com.fasterxml.jackson.databind.node.ObjectNode mergedArray, com.fasterxml.jackson.databind.node.ArrayNode items)
    • convertToFormat

      protected abstract com.fasterxml.jackson.databind.JsonNode convertToFormat(com.fasterxml.jackson.databind.JsonNode schema, String name)
    • mergeMultipleDataTypes

      protected abstract com.fasterxml.jackson.databind.node.ObjectNode mergeMultipleDataTypes(com.fasterxml.jackson.databind.node.ObjectNode mergedArray, List<com.fasterxml.jackson.databind.JsonNode> primitives, List<com.fasterxml.jackson.databind.JsonNode> records, List<com.fasterxml.jackson.databind.JsonNode> arrays, boolean check2dArray)
    • mergeMultipleMessages

      protected abstract com.fasterxml.jackson.databind.node.ArrayNode mergeMultipleMessages(List<com.fasterxml.jackson.databind.JsonNode> uniqueSchemas, Map<com.fasterxml.jackson.databind.JsonNode,com.fasterxml.jackson.databind.node.ArrayNode> schemaToIndex)