yang-data-api: use yang.common.Decimal64 for decimal64 leaves
Description
Using BigDecimal does not really work for handling of decimal64 type semantics. It does not enforce the set of allowed ranges, nor values.
Create a dedicated subclass of java.lang.Number, which will implement exact http://tools.ietf.org/html/rfc6020#section-9.3 decimal64 as a long field to hold the value and the scaling value (1-18). Comparable<Decimal64> needs to be implemented (using adjusting scales as needed). The toString() should emit the canonical representation. valueOf(String) should accept any legal representation.
A migration strategy for NormalizedNode users needs to be devised, as a straight switchover would break current users, who assume BigDecimal. This should probably involve a 'TypeValueSupport' interface, which would be used to access the value inside the leaf. Implementations would perform dynamic translation as needed.
Evaluate the resulting interface for use in the solution for YANGTOOLS-418.
Using BigDecimal does not really work for handling of decimal64 type semantics. It does not enforce the set of allowed ranges, nor values.
Create a dedicated subclass of java.lang.Number, which will implement exact http://tools.ietf.org/html/rfc6020#section-9.3 decimal64 as a long field to hold the value and the scaling value (1-18). Comparable<Decimal64> needs to be implemented (using adjusting scales as needed). The toString() should emit the canonical representation. valueOf(String) should accept any legal representation.
A migration strategy for NormalizedNode users needs to be devised, as a straight switchover would break current users, who assume BigDecimal. This should probably involve a 'TypeValueSupport' interface, which would be used to access the value inside the leaf. Implementations would perform dynamic translation as needed.
Evaluate the resulting interface for use in the solution for YANGTOOLS-418.