[MDSAL-742] Sanititize bits type mapping Created: 11/Apr/22 Updated: 09/Jan/24 |
|
| Status: | Confirmed |
| Project: | mdsal |
| Component/s: | Binding codegen, Binding runtime, Binding Spec |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Epic | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Name: | Evolve bits mapping |
| Description |
|
We map a "bits" type to a dedicated TypeObject. We already have a ScalarTypeObject specialization which has getValue() method.
public static MyBits getDefaultInstance(final String defaultValue) {
List<String> properties = Lists.newArrayList("bitOne",
"bitTwo",
"bitZero"
);
if (!properties.contains(defaultValue)) {
throw new IllegalArgumentException("invalid default parameter");
}
int i = 0;
return new MyBits(
properties.get(i++).equals(defaultValue) ? Boolean.TRUE : null,
properties.get(i++).equals(defaultValue) ? Boolean.TRUE : null,
properties.get(i++).equals(defaultValue) ? Boolean.TRUE : null
);
}
There are so many things wrong in this mapping it's not even funny. Let's evolve this thing into something sane in terms of interface modeling, implementation design as well as interactions with runtime. |