Package redempt.ordinate.command
Class ArgType<T,V>
java.lang.Object
redempt.ordinate.command.ArgType<T,V>
- Type Parameters:
T
- The sender typeV
- The argument type
- All Implemented Interfaces:
Named
Represents a parsable type that can be used in command arguments
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomplete
(CommandContext<T> context, String partial) Get completions for a given partial stringcompleter
(BiFunction<CommandContext<T>, String, Collection<String>> completer) Set how completions for this type should be computedcompleter
(Function<CommandContext<T>, Collection<String>> completer) Set how completions for this type should be computedcompleterStream
(BiFunction<CommandContext<T>, String, Stream<String>> completer) Set how completions for this type should be computedcompleterStream
(Function<CommandContext<T>, Stream<String>> completer) Set how completions for this type should be computedconstraint
(ConstraintParser<T, V> constraintParser) Assign aConstraintParser
, which can be used to set constraints for this type in the command fileconvert
(CommandContext<T> context, String arg) Convert an argumentgetName()
static <T,
V> ArgType<T, V>
-
Constructor Details
-
ArgType
- Parameters:
name
- The name of the ArgTypeconverter
- A function to parse the type
-
ArgType
- Parameters:
name
- The name of the ArgTypeconverter
- A function to parse the type
-
-
Method Details
-
of
-
getName
-
convert
Convert an argument- Parameters:
context
- The context of the command's executionarg
- The string value of the argument- Returns:
- The parsed value
-
complete
Get completions for a given partial string- Parameters:
context
- The context of the command's executionpartial
- The partial argument- Returns:
- A collection of completions
-
constraint
Assign aConstraintParser
, which can be used to set constraints for this type in the command file- Parameters:
constraintParser
- The constraint parser- Returns:
- Itself
-
completer
Set how completions for this type should be computed- Parameters:
completer
- A function which provides completions- Returns:
- Itself
-
completer
Set how completions for this type should be computed- Parameters:
completer
- A function which provides completions- Returns:
- Itself
-
completerStream
Set how completions for this type should be computed- Parameters:
completer
- A function which provides completions- Returns:
- Itself
-
completerStream
Set how completions for this type should be computed- Parameters:
completer
- A function which provides completions- Returns:
- Itself
-
getConstraintParser
- Returns:
- The constraint parser for this type
-