Class BytesDecimalConverter

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

public class BytesDecimalConverter extends Object implements AvroTypeConverter
  • Field Details

  • Constructor Details

    • BytesDecimalConverter

      public BytesDecimalConverter()
  • Method Details

    • convert

      public Object convert(org.apache.avro.Schema.Field field, org.apache.avro.Schema schema, Object value, 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
      value - 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
    • convertDecimal

      protected Object convertDecimal(Object value, int scale, Deque<String> path)
    • bigDecimalWithExpectedScale

      protected BigDecimal bigDecimalWithExpectedScale(String decimal, int scale, Deque<String> path)
    • canManage

      public boolean canManage(org.apache.avro.Schema schema, Deque<String> deque)
      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
      deque - 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