Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Support @Nonnull on parameters of command handler methods #28

Open
Vampire opened this issue Dec 16, 2017 · 2 comments
Open

Support @Nonnull on parameters of command handler methods #28

Vampire opened this issue Dec 16, 2017 · 2 comments

Comments

@Vampire
Copy link

Vampire commented Dec 16, 2017

Check for jsr305 annotation @Nonnull on a parameter and if the parameter is annotated with it, but you would give null or an empty Optional to it, either throw an exception or make a debug log statement and just do not call the handler

@darichey
Copy link

Can this not be validated on the user side? A simple Objects.requireNonNull() call would suffice.

@Vampire
Copy link
Author

Vampire commented Dec 28, 2017

Sure it could. This is about convenience.
The lib could do it for you, so it is simpler to use the simple command framework.
Depending on whether an exception is thrown or just a debug statement and the handler not called, you can easily define with this conditions for the command like you can do now with Command.channelMessages and Command.privateMessages, just that you can do it for all the potential parameters.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants