Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-556

yang-data-api: use yang.common.Decimal64 for decimal64 leaves

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Highest Highest
    • 8.0.0
    • None
    • None
    • None
    • Operating System: All
      Platform: All

      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.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: