Details
-
Improvement
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
Operating System: Linux
Platform: PC
Description
In our builders, we should never accept a null-valued list. When building the object, if the list-valued field is null, then we should set it to Collections.emptyList() instead. This makes writing code much more pleasant and really has no downside.
We have something like this: // check if empty if (myObjects.getListParam() == null || myObjects.getListParam().size() == 0) { // ... } becomes: if (myObjects.getListParam().size() == 0) { // ... } And this: if (myObjects.getListParam() != null) { for (ListValue v : myObjects.getListParam()) { // ... } } becomes: for (ListValue v : myObjects.getListParam()) { // ... }
Much nicer!
Attachments
Issue Links
- relates to
-
YANGTOOLS-585 Data tree: automatic structural lifecycle
- Resolved
| # | Subject | Branch | Project | Status | CR | V |
|---|---|---|---|---|---|---|
| 76979,2 | Return empty list for non-present non-mandatory lists | master | mdsal | Status: ABANDONED | 0 | -1 |
| 77616,12 | Move getter method naming to BindingMapping | master | mdsal | Status: MERGED | +2 | +1 |
| 77617,11 | Revert "Add DataObjectUtils" | master | mdsal | Status: MERGED | +2 | +1 |
| 77623,3 | Refactor DataObjectCodecContext.getBindingChildValue() | master | mdsal | Status: MERGED | +2 | +1 |
| 77624,4 | Prevent NPE from being propagated from LazyDataObject | master | mdsal | Status: MERGED | +2 | +1 |
| 77627,11 | Generate nonnull default wrappers for list getters | master | mdsal | Status: MERGED | +2 | +1 |
| 77644,3 | Refactor DataObjectCodecContext.getBindingChildValue() | stable/fluorine | mdsal | Status: MERGED | +2 | +1 |
| 77645,3 | Prevent NPE from being propagated from LazyDataObject | stable/fluorine | mdsal | Status: MERGED | +2 | +1 |
| 77893,7 | Fix InterfaceGenerator confusion with RPC method names | master | mdsal | Status: MERGED | +2 | +1 |
| 78102,9 | Teach MethodSignature about default methods | master | mdsal | Status: MERGED | +2 | +1 |