You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Zadravec János <jz...@gmail.com> on 2017/08/24 09:31:30 UTC
registering custom logical type with java
Hi Guys,
I am trying to register custom logical type handler in Java, but don't know
how to map the java class to the logical type in the schema.
My class
public class ShortString extends LogicalType{
public ShortString() {
super("short-string");
}
@Override
public void validate(Schema schema) {
throw new IllegalArgumentException("not implemented");
}
}
My schema:
"type": "record",
"namespace": "com.xy.serialization",
"name": "SerializableLineItem",
"fields":
[
{
"name": "lineItemId",
"type": "string",
"logicalType": "short-string",
"namespace": "com.amazon.awsbilladjustments.avro"
}
]
}, {logicalTypes: {'short-string': ????ShortString.class????}}
Anyobdy has any idea ?
Thanks,
Janos