Add BitsTypeObject

Description

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"); @Override 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[]{ _one, _bar }; }

Activity

Show:
Done

Details

Assignee

Reporter

Fix versions

Priority

Created April 11, 2022 at 7:48 PM
Updated December 5, 2022 at 5:41 PM
Resolved November 18, 2022 at 12:17 AM