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

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

    XMLWordPrintable

Details

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

    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.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: