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

Map bits type to primitive boolean

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Highest
    • Resolution: Done
    • None
    • 11.0.0
    • Binding codegen

    Description

      We are currently mapping individual 'bits' components to a Boolean:

      public class Foo
       implements TypeObject, Serializable {
          private static final long serialVersionUID = -339486881606097888L;
          private final Boolean _one;
          private final Boolean _bar;
      
          // ...
      
          public Boolean getOne() {
              return _one;
          }
      
          public Boolean getBar() {
              return _bar;
          }
      

      The storage requirements here are an object reference and the implied nullability, exposed to users, just does not make any sense. Fix the code generator to emit simple 'boolean' properties here:

      public class Foo
       implements TypeObject, Serializable {
          private static final long serialVersionUID = -339486881606097888L;
          private final boolean _one;
          private final boolean _bar;
      
          // ...
      
          public boolean getOne() {
              return _one;
          }
      
          public boolean getBar() {
              return _bar;
          }
      

      This will drop storage requirements by 4x (32bit/compressed oops JVM) or 8x (64bit JVM).

      As part of this change, we also need to simplify the toString() method, so that it just lists those bits which are set and not all lists with their false/true values.

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: