Zoltan Farkas created AVRO-2938:
-----------------------------------

             Summary: Make Conversion more generic.
                 Key: AVRO-2938
                 URL: https://issues.apache.org/jira/browse/AVRO-2938
             Project: Apache Avro
          Issue Type: Improvement
            Reporter: Zoltan Farkas


Currently  Conversion<T> is parametrizable only by the java Type.
However, I think there would be a benefit to add an extra parameter:
Conversion<T, L extends LogicalType>

this way for DecimalConversion implementation would become cleaner without the 
need of casts everywhere the logical type attributes are needed:

```
    @Override
    public BigDecimal fromBytes(ByteBuffer value, Schema schema, LogicalType 
type) {
      int scale = ((Decimal) type).getScale();
```

to 

```
    @Override
    public BigDecimal fromBytes(ByteBuffer value, Schema schema, Decimal type) {
      int scale = type.getScale();
```

I could do a PR for this is there are no abjections.







--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to