Class BytesDecimalConverter
java.lang.Object
tech.allegro.schema.json2avro.converter.types.BytesDecimalConverter
- All Implemented Interfaces:
AvroTypeConverter
-
Nested Class Summary
Nested classes/interfaces inherited from interface tech.allegro.schema.json2avro.converter.types.AvroTypeConverter
AvroTypeConverter.Incompatible -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected BigDecimalbigDecimalWithExpectedScale(String decimal, int scale, Deque<String> path) booleanused to know if this class can convert the json value to the avro valueconvert(org.apache.avro.Schema.Field field, org.apache.avro.Schema schema, Object value, Deque<String> path, boolean silently) convert the json jsonValue to the avro jsonValueprotected ObjectconvertDecimal(Object value, int scale, Deque<String> path)
-
Field Details
-
INSTANCE
-
-
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:AvroTypeConverterconvert the json jsonValue to the avro jsonValue- Specified by:
convertin interfaceAvroTypeConverter- Parameters:
field- the field to convertschema- the schema of the fieldvalue- the json jsonValuepath- the path of the fieldsilently- 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
-
bigDecimalWithExpectedScale
-
canManage
Description copied from interface:AvroTypeConverterused to know if this class can convert the json value to the avro value- Specified by:
canManagein interfaceAvroTypeConverter- Parameters:
schema- the avro schema in which to convert the jsondeque- 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
-