Annotation Interface Default


@Target({PARAMETER,METHOD}) @Retention(RUNTIME) public @interface Default
Adds a default value for a parameter when it is not supplied.

Due to limitations and simply the lots of "edge cases", this parameter only works if there are no parameters after it, or if all following parameters are also marked with Default.

Note that if any parameter is annotated with Default, it will automatically be marked as optional.

Accessible with CommandParameter.getDefaultValue().

Aside from being used on parameters, this annotation can also be used on methods that should be invoked when an invalid command is inputted in the command tree. Methods annotated with Default can have parameters just like any other command methods.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The default value.
  • Element Details

    • value

      String[] value
      The default value. This will be passed to resolvers just as if the user inputted it.

      If none is specified, and the argument is not present, null will be passed to the command.

      Returns:
      The parameter's default value. Multiple strings indicate more than 1 argument. Supplying an empty array will be ignored
      Default:
      {}