Class UnionConverter

java.lang.Object
tech.allegro.schema.json2avro.converter.types.UnionConverter
All Implemented Interfaces:
AvroTypeConverter

public class UnionConverter extends Object implements AvroTypeConverter
  • Constructor Details

  • Method Details

    • convert

      public Object convert(org.apache.avro.Schema.Field field, org.apache.avro.Schema schema, Object jsonValue, Deque<String> path, boolean silently)
      Description copied from interface: AvroTypeConverter
      convert the json jsonValue to the avro jsonValue
      Specified by:
      convert in interface AvroTypeConverter
      Parameters:
      field - the field to convert
      schema - the schema of the field
      jsonValue - the json jsonValue
      path - the path of the field
      silently - should be false to throw an error in case of incompatible java type for the avro type
      Returns:
      the converted jsonValue or an Incompatible instance if silently is true and value is incompatible
    • canManage

      public boolean canManage(org.apache.avro.Schema schema, Deque<String> path)
      Description copied from interface: AvroTypeConverter
      used to know if this class can convert the json value to the avro value
      Specified by:
      canManage in interface AvroTypeConverter
      Parameters:
      schema - the avro schema in which to convert the json
      path - the path of the current field. Can be used to define a specific converter for a path
      Returns:
      true if this class should be used to convert the value