Package cloud.commandframework.arguments
Class CommandArgument.TypedBuilder<C,T,B extends CommandArgument.Builder<C,T>>
java.lang.Object
cloud.commandframework.arguments.CommandArgument.Builder<C,T>
cloud.commandframework.arguments.CommandArgument.TypedBuilder<C,T,B>
- Type Parameters:
C
- sender typeT
- argument value typeB
- the subclass type
- Enclosing class:
- CommandArgument<C,T>
public abstract static class CommandArgument.TypedBuilder<C,T,B extends CommandArgument.Builder<C,T>>
extends CommandArgument.Builder<C,T>
A variant of builders designed for subclassing, that returns a self type.
- Since:
- 1.5.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TypedBuilder(@NonNull io.leangen.geantyref.TypeToken<T> valueType, @NonNull String name)
protected
TypedBuilder(@NonNull Class<T> valueType, @NonNull String name)
-
Method Summary
Modifier and TypeMethodDescription@NonNull B
Indicates that the argument is optional.@NonNull B
asOptionalWithDefault(@NonNull String defaultValue)
Indicates that the argument is optional.@NonNull B
Indicates that the argument is required.@NonNull B
manager(@NonNull CommandManager<C> manager)
Set the command manager.protected B
self()
@NonNull B
withParser(@NonNull ArgumentParser<@NonNull C,@NonNull T> parser)
Set the argument parser@NonNull CommandArgument.Builder<@NonNull C,@NonNull T>
withSuggestionsProvider(@NonNull BiFunction<@NonNull CommandContext<C>,@NonNull String,@NonNull List<String>> suggestionsProvider)
Set the suggestions providerMethods inherited from class cloud.commandframework.arguments.CommandArgument.Builder
build, getDefaultDescription, getDefaultValue, getName, getParser, getSuggestionsProvider, getValueType, isRequired, withDefaultDescription
-
Constructor Details
-
TypedBuilder
-
TypedBuilder
-
-
Method Details
-
self
-
manager
Set the command manager. Will be used to create a default parser if none was provided- Overrides:
manager
in classCommandArgument.Builder<C,T>
- Parameters:
manager
- Command manager- Returns:
- Builder instance
-
asRequired
Indicates that the argument is required. All arguments prior to any other required argument must also be required, such that the predicate (∀ c_i ∈ required)({c_0, ..., c_i-1} ⊂ required) holds true, where {c_0, ..., c_n-1} is the set of command arguments.- Overrides:
asRequired
in classCommandArgument.Builder<C,T>
- Returns:
- Builder instance
-
asOptional
Indicates that the argument is optional. All arguments prior to any other required argument must also be required, such that the predicate (∀ c_i ∈ required)({c_0, ..., c_i-1} ⊂ required) holds true, where {c_0, ..., c_n-1} is the set of command arguments.- Overrides:
asOptional
in classCommandArgument.Builder<C,T>
- Returns:
- Builder instance
-
asOptionalWithDefault
Indicates that the argument is optional. All arguments prior to any other required argument must also be required, such that the predicate (∀ c_i ∈ required)({c_0, ..., c_i-1} ⊂ required) holds true, where {c_0, ..., c_n-1} is the set of command arguments.- Overrides:
asOptionalWithDefault
in classCommandArgument.Builder<C,T>
- Parameters:
defaultValue
- Default value that will be used if none was supplied- Returns:
- Builder instance
-
withParser
Set the argument parser- Overrides:
withParser
in classCommandArgument.Builder<C,T>
- Parameters:
parser
- Argument parser- Returns:
- Builder instance
-
withSuggestionsProvider
public @NonNull CommandArgument.Builder<@NonNull C,@NonNull T> withSuggestionsProvider(@NonNull BiFunction<@NonNull CommandContext<C>,@NonNull String,@NonNull List<String>> suggestionsProvider)Set the suggestions provider- Overrides:
withSuggestionsProvider
in classCommandArgument.Builder<C,T>
- Parameters:
suggestionsProvider
- Suggestions provider- Returns:
- Builder instance
-