[MDSAL-744] Map bits type to primitive boolean Created: 11/Apr/22 Updated: 10/Nov/22 Resolved: 10/Nov/22 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding codegen |
| Affects Version/s: | None |
| Fix Version/s: | 11.0.0 |
| Type: | Improvement | Priority: | Highest |
| Reporter: | Robert Varga | Assignee: | Ivan Martiniak |
| Resolution: | Done | Votes: | 0 |
| Labels: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Epic Link: | Evolve bits mapping | ||||||||
| 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. |