Interface NumberParser<P extends @NonNull Number & Comparable<P>,T extends @NonNull Object>
- Type Parameters:
P- The type of number.T- The type of argument that is provided.
- All Superinterfaces:
ArgumentParser<P,,T> BiFunction<CommandContext,,P, Mono<T>> ChoicesParser<P,,T> InputParser<P,,T> ParserFunction<P,T>
- All Known Subinterfaces:
FloatParser<T>,IntegerParser<T>
public sealed interface NumberParser<P extends @NonNull Number & Comparable<P>,T extends @NonNull Object>
extends ChoicesParser<P,T>
permits IntegerParser<T>, FloatParser<T>
Parses number-based input arguments.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ChoicesParser
ChoicesParser.Choice<P extends @NonNull Object>Nested classes/interfaces inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
ParserFunction.PostParser<R extends @NonNull Object,I extends @NonNull Object, T extends @NonNull Object, P1 extends @NonNull ParserFunction<R, I>, P2 extends @NonNull ParserFunction<I, T>> -
Field Summary
Fields inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ChoicesParser
MAX_CHOICES -
Method Summary
Modifier and TypeMethodDescriptionmaximum()The maximum value allowed (inclusive).minimum()The minimum value allowed (inclusive).default PvalidateRaw(P raw) Validates the raw value before parsing.default PverifyInRange(P value) Verifies that the given value is within the allowed range for this parser.Methods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ArgumentParser
parse, parseArgumentMethods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ChoicesParser
choices, verifyChoiceMethods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
apply, then
-
Method Details
-
minimum
The minimum value allowed (inclusive).- Returns:
- The value, or
nullif no minimum. - Implementation Requirements:
- The default is
null.
-
maximum
The maximum value allowed (inclusive).- Returns:
- The value, or
nullif no maximum. - Implementation Requirements:
- The default is
null.
-
verifyInRange
Verifies that the given value is within the allowed range for this parser.- Parameters:
value- The value to validate.- Returns:
- The value.
- Throws:
InvalidArgumentException- If the value is outside the allowed range.
-
validateRaw
Description copied from interface:ArgumentParserValidates the raw value before parsing.- Specified by:
validateRawin interfaceArgumentParser<P extends @NonNull Number & Comparable<P>,T extends @NonNull Object> - Specified by:
validateRawin interfaceChoicesParser<P extends @NonNull Number & Comparable<P>,T extends @NonNull Object> - Parameters:
raw- The raw value.- Returns:
- The raw value.
- Throws:
InvalidArgumentException- if the value is invalid.
-