jackson-databind-nullable
jackson-databind-nullable copied to clipboard
New Method isUndefined
Hey,
@cbornet convinced me, it's really better to use the JsonNullable
instead of Optionals
.
From the discussion here https://github.com/OpenAPITools/openapi-generator/pull/3214, the question: Make it sense to create a new method isUndefined()
@JsonIgnore
public boolean isUndefined(){
return UNDEFINED.equals(this);
}
Before i create a PR, is there a reason why we should not create this method?
Glad I convinced you 😀. At first I thought that it wouldn't be necessary since we already have isPresent()
but I see that Java 11 introduced isEmpty()
for Optional so I guess we can do the same. It's probably nice to use it as method reference in filter operations.
About the implementation, I think it would be better to just return !isPresent
.
Maybe I misunderstood it, but how can you find out if the state is a "reset" or not?
Is the reset state a JsonNullable.of(null)
. So it's present but the value is null
?
If JsonNullable is in state "undefined", isPresent()
returns false. Otherwise it returns true.
Why did you close ?
Yes, then an extension for isUndefined
would make more sense.
I adjust the title of the ticket.
Hi @cbornet , PR is open :)