Skip to content

09) Provided Annotations

ly.ton edited this page Dec 22, 2017 · 1 revision

This page provides a list of annotations that have been pre-defined. Note that the behavior for any of these annotations can be overridden. For the code used to add the annotations, see here.

@Command, @MainCommand

Field: String[] keys
Target: Method
Default Value: Name of Method
Function: CommandHandleBuilder#setKeys(String... key)

@Name

Field: String name
Target: Method
Default Value: Name of Method
Function: CommandHandleBuilder#setName(String name)

@Group

Field: String group
Target: Package, Class, Method
Default Value: Package name; If the class is in a package that is named "command(s)", it will be set to the name of its package's enclosing package.
Function: CommandHandleBuilder#setGroup(String group)

@Description

Field: String group
Target: Method
Default Value: null
Function: CommandHandleBuilder#setDescription(String description)

@RequiredParameters

Field: int[] indices
Target: Method
Default Value: {}
Function:

for (int i : annotation.indices()) {
    command.configureParameter(i, param -> param.setRequired(true));
}

@Delimiter

Field: String regex; int limit = 0 Target: Method, Class, Package Default Value: Splits on spaces unless enclosed by quotes or backticks Function: command.setSplitRegex(annotation.regex(), annotations.limit())

@HandleAbsentArgument

Field: Class<? extends AbsentArgumentHandler> handler Target: Parameter, Method, Class Default Value: Function:

@Flags

Field: Target: Default Value: Function:

@Contiguous

Field: Target: Default Value: Function:

@

Field: Target: Default Value: Function:

@MatchRegex

Field: Target: Default Value: Function:

@RegisterArgumentMapper

Field: Target: Default Value: Function:

@Required

Field: Target: Default Value: Function:

@Type

Field: Target: Default Value: Function:

@Width

Field: Target: Default Value: Function:

Annotation Fields Target Default Value Function
@Command @MainCommand String[] keys Method Method name command.setKeys(annotation.value())
@Name String name Method Method name command.setName(annotation.value())
@Group String group Method, Class, Package Package name. If it's command(s), it will be enclosing Package name. command.setGroup(annotation.value())
@Description String desc Method null command.setDescription(annotation.value())
@RequiredParameters int[] indices Method {} for (int i : annotation.value()) { command.configureParameter(i, param -> param.setRequired(true));