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

yang-model-api: define a structured type for union values

    XMLWordPrintable

Details

    • New Feature
    • Status: Confirmed
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    Description

      Union values are a nasty beast, as they are polymorphic and do not really have a native type. RFC6020(bis) maps their type to the first conforming member, which means each time we want to instantiate a union DTO (in Java Bindings, but this is not specific to them), we have to check each possibility until we find a match. This is especially troublesome unions of exotic types like binary, where the cost of getting the common representation cost quite a few CPU cycles.

      Introduce a dedicated value class for use with union types, which aside from the value in native type will hold the SchemaPath of the type being stored. It needs to be exposed as an Optional<SchemaPath> for compatibility with schema-less producers.

      This would probably be also beneficial for String types, where we get it trouble with Binding subclasses.

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated: