hedera-mirror-node icon indicating copy to clipboard operation
hedera-mirror-node copied to clipboard

Use spring ConversionService for type conversion in rest-java `DomainRecordMapper`

Open xin-hedera opened this issue 2 years ago • 0 comments

Problem

The type conversion logic in DomainRecordMapper which converts several data types in jooq Record class to types in our domain classes are verbose and brittle. Namely

  • jooq EnumType to our domain enum classes
  • jooq Short to our domain enum classes
  • jooq LongRange to Range<Long>, most of them are timestamp ranges
  • Long to EntityId
  • Different Number types

Solution

Register converters and use Spring ConversionService. Note, it may not be possible to do the same for JSONB to parameterized Collection type conversion, since it requires the parameterized type as well.

Alternatives

No response

xin-hedera avatar Mar 15 '24 00:03 xin-hedera