Interface JsonToAvroReader

All Known Implementing Classes:
CompositeJsonToAvroReader

public interface JsonToAvroReader
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.avro.generic.GenericData.Record
    read(Map<String,Object> json, org.apache.avro.Schema schema)
    convert a Map to a generic record
    read(org.apache.avro.Schema.Field field, org.apache.avro.Schema schema, Object jsonValue, Deque<String> path, boolean silently)
    allow to convert a json field to type corresponding avro type
  • Method Details

    • read

      org.apache.avro.generic.GenericData.Record read(Map<String,Object> json, org.apache.avro.Schema schema)
      convert a Map to a generic record
      Parameters:
      json - the json to convert
      schema - the avro schema to use
      Returns:
      the converted Record
    • read

      Object read(org.apache.avro.Schema.Field field, org.apache.avro.Schema schema, Object jsonValue, Deque<String> path, boolean silently)
      allow to convert a json field to type corresponding avro type
      Parameters:
      field - the avro field to create
      schema - the schema associated to the field
      jsonValue - the json jsonValue of the field
      path - the path of the field on the json
      silently - should be false to throw an error in case of incompatible java type for the avro type
      Returns:
      the converted jsonValue