Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Method isUndefined #7

Open
MelleD opened this issue Jun 27, 2019 · 5 comments
Open

New Method isUndefined #7

MelleD opened this issue Jun 27, 2019 · 5 comments

Comments

@MelleD
Copy link
Contributor

MelleD commented Jun 27, 2019

Hey,

@cbornet convinced me, it's really better to use the JsonNullable instead of Optionals.
From the discussion here OpenAPITools/openapi-generator#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?

@cbornet
Copy link
Member

cbornet commented Jun 28, 2019

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.

@MelleD
Copy link
Contributor Author

MelleD commented Jun 28, 2019

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?

@MelleD MelleD closed this as completed Jun 28, 2019
@cbornet
Copy link
Member

cbornet commented Jun 28, 2019

If JsonNullable is in state "undefined", isPresent() returns false. Otherwise it returns true.
Why did you close ?

@MelleD
Copy link
Contributor Author

MelleD commented Jul 1, 2019

Yes, then an extension for isUndefined would make more sense.

I adjust the title of the ticket.

@MelleD MelleD reopened this Jul 1, 2019
@MelleD MelleD changed the title New Method isUndefined New Method isEmpty Jul 1, 2019
@MelleD
Copy link
Contributor Author

MelleD commented Jul 3, 2019

Hi @cbornet , PR is open :)

@MelleD MelleD changed the title New Method isEmpty New Method isUndefined Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants