Class AbstractDateTimeConverter
java.lang.Object
tech.allegro.schema.json2avro.converter.types.AbstractDateTimeConverter
- All Implemented Interfaces:
AvroTypeConverter
- Direct Known Subclasses:
AbstractIntDateTimeConverter,AbstractLongDateTimeConverter
-
Nested Class Summary
Nested classes/interfaces inherited from interface tech.allegro.schema.json2avro.converter.types.AvroTypeConverter
AvroTypeConverter.Incompatible -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanused 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 jsonValue, Deque<String> path, boolean silently) convert the json jsonValue to the avro jsonValueprotected abstract ObjectconvertDateTimeString(String dateTimeString) protected abstract ObjectconvertNumber(Number numberValue) protected abstract org.apache.avro.LogicalTypeprotected abstract org.apache.avro.Schema.Typeprotected abstract Stringprotected abstract String
-
Constructor Details
-
AbstractDateTimeConverter
public AbstractDateTimeConverter()
-
-
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:AvroTypeConverterconvert the json jsonValue to the avro jsonValue- Specified by:
convertin interfaceAvroTypeConverter- Parameters:
field- the field to convertschema- the schema of the fieldjsonValue- 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
-
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 jsonpath- 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
-
convertDateTimeString
-
convertNumber
-
getUnderlyingSchemaType
protected abstract org.apache.avro.Schema.Type getUnderlyingSchemaType() -
getLogicalType
protected abstract org.apache.avro.LogicalType getLogicalType() -
getValidStringFormat
-
getValidNumberFormat
-