Interface ValueParameter.Simple<T>
-
- Type Parameters:
T- The type of object that is returned from theValueParserupon successful parsing.
- All Superinterfaces:
DefaultedRegistryValue,ValueCompleter,ValueParameter<T>,ValueParser<T>,ValueUsage
- All Known Subinterfaces:
ResourceKeyedValueParameter<T>
- Enclosing interface:
- ValueParameter<T>
public static interface ValueParameter.Simple<T> extends ValueParameter<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.command.parameter.managed.ValueParameter
ValueParameter.Simple<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.List<CommandCompletion>complete(CommandCause context, java.lang.String currentInput)Gets valid completions for this element, given the suppliedCommandCauseand current input for this element.default java.util.List<CommandCompletion>complete(CommandContext context, java.lang.String currentInput)This should not be overridden by implementations of this class.java.util.Optional<? extends T>parseValue(CommandCause commandCause, ArgumentReader.Mutable reader)Gets the value for this parameter.default java.util.Optional<? extends T>parseValue(Parameter.Key<? super T> parameterKey, ArgumentReader.Mutable reader, CommandContext.Builder context)This should not be overridden by implementations of this class.-
Methods inherited from interface org.spongepowered.api.registry.DefaultedRegistryValue
asDefaultedReference, findKey, key
-
Methods inherited from interface org.spongepowered.api.command.parameter.managed.ValueParameter
usage
-
Methods inherited from interface org.spongepowered.api.command.parameter.managed.ValueParser
clientCompletionType
-
-
-
-
Method Detail
-
parseValue
java.util.Optional<? extends T> parseValue(CommandCause commandCause, ArgumentReader.Mutable reader) throws ArgumentParseException
Gets the value for this parameter.This should have no side effects on anything except on the state of the
ArgumentReader.This element may return nothing in the form of an empty optional. This indicates that a parse succeeded, but no meaningful value was returned.
- Parameters:
commandCause- Thecauseof this parsereader- TheArgumentReaderthat contains the unparsed arguments- Returns:
- Returns the value(s)
- Throws:
ArgumentParseException- if a parameter could not be parsed
-
parseValue
default java.util.Optional<? extends T> parseValue(Parameter.Key<? super T> parameterKey, ArgumentReader.Mutable reader, CommandContext.Builder context) throws ArgumentParseException
This should not be overridden by implementations of this class. If you wish to do so, implementValueParameterinstead. Gets the value for the parameter. This may return more than one value by adding additional values to the suppliedCommandContext.Builder.This should have no side effects on anything except on the state of the
ArgumentReaderand, in rare cases, theCommandContext.Builder.This element may return nothing in the form of an empty optional. This indicates that a parse succeeded, but no meaningful value was returned, for example, the argument must be passed but it's not necessary for the associated
CommandExecutorto know what the result of the parse was. TheCommandContext.Buildermay be updated in this case.While the
CommandContext.Builderis provided, in general, you do not need to add the parsed value to it yourself, instead preferring to return your parsed value. It is permissible, however, to add additional information to the context should it be required.The
Causeof this parse is provided in theCommandContext.Builder.- Specified by:
parseValuein interfaceValueParser<T>- Parameters:
parameterKey- TheParameter.Keyof the parameter being parsedreader- TheArgumentReaderthat contains the unparsed argumentscontext- TheCommandContextcontaining the state about this command- Returns:
- Returns the value(s)
- Throws:
ArgumentParseException- if a parameter could not be parsed
-
complete
java.util.List<CommandCompletion> complete(CommandCause context, java.lang.String currentInput)
Gets valid completions for this element, given the suppliedCommandCauseand current input for this element.- Parameters:
context- TheCommandCausethat contains the parsed argumentscurrentInput- The current input for this argument- Returns:
- The list of values
-
complete
default java.util.List<CommandCompletion> complete(CommandContext context, java.lang.String currentInput)
This should not be overridden by implementations of this class. If you wish to do so, implementValueParameterinstead. Gets valid completions for this element, given the suppliedCommandContextand current input for this element.- Specified by:
completein interfaceValueCompleter- Parameters:
context- TheCommandContextthat contains the parsed argumentscurrentInput- The current input for this argument- Returns:
- The list of values
-
-