Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-743

Add BitsTypeObject


      Similar to how we have ScalarTypeObject, we should have a BitsTypeObject. In general this mapping involves a property for each mentioned bit.

      The major question is: what useful property (aside 'this is a bits type') can such interface expose.

      RFC6020 does not allow any modification to which bits are valid. RFC7950 allows bits to be restricted (e.g. removed), but does not allow extension.

      It therefore would be useful to expose a constant in the shape of:

      public interface BitsTypeObject extends TypeObject {
         // Valid bit values, ordered by 'position' statement value, hence iteration order is significant
         ImmutableSet<String> validValues(); 
      public class MyBits
       implements BitsTypeObject, Serializable {
         // ImmutableSet because of ordering
         public static final Set<String> VALID_BITS = ImmutableSet.of("one", "bar");
         public ImmutableSet<String> validValues() {
           return VALID_BITS;

      Obviously we want to generate these two only for types which are restricted and defer to superclass if they are not.

      The other method to be included is this:

         public boolean[] getValue() {
              return new boolean[]{

            ivanm1996 Ivan Martiniak
            rovarga Robert Varga
            0 Vote for this issue
            1 Start watching this issue