Incendo / cloud

Command framework & dispatcher for the JVM
https://cloud.incendo.org
MIT License
438 stars 54 forks source link

Allow for optionals in annotated methods #768

Open Citymonstret opened 2 months ago

Citymonstret commented 2 months ago

We should allow for optionals to be used in annotated arguments in place of nullable parameters. Example:

@Command("command [component]")
public void someCommand(Optional<SomeType> component) {
  // ...
}

We should be able to infer the type of the optional without any issues. We will need to consider the mapping between components and optionals both when parsing & constructing the command tree, but also when mapping the parsed values to the method parameters.