public interface RelevantNullChecker
null
for POST operation (sent to remote service).
The basic motivation behind is to avoid to send for example the following:
{
"firstName": "John",
"address": {
"street": null,
"city": null
}
or
{
"firstName": "John",
"address": {}
}
The proper JSON for above should look like:
{
"firstName": "John"
}
| Modifier and Type | Method and Description |
|---|---|
boolean |
allNull()
Checks whether this resource has at least a single property with non
null
value within its tree, among those that has been included to be checked. |
default boolean |
allNull(Object... values)
Checks whether the input values has at least single non
null value within its tree. |
default <T extends RelevantNullChecker> |
setIfNotAllNull(Consumer<T> setter,
T value)
Sets value at consumer (setter) only if input value meets a condition.
|
boolean allNull()
null
value within its tree, among those that has been included to be checked.true if at least a single property of this resource has a non null value,
otherwise falsedefault <T extends RelevantNullChecker> boolean setIfNotAllNull(@Nonnull Consumer<T> setter, @Nullable T value)
T - the type of the valuesetter - the consumer to be used to set value only if allNull(Object...) returns truevalue - the value to be checked and set if meets conditiontrue if value from the input tree has at least single non null value within its tree,
otherwise falsedefault boolean allNull(@Nullable Object... values)
null value within its tree.values - those values that are relevant to be sent to remote servicetrue if at least a single value from the input a non null value,
otherwise falseCopyright © 2020. All rights reserved.