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 P
validateRaw
(P raw) Validates the raw value before parsing.default P
verifyInRange
(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, parseArgument
Methods inherited from interface java.util.function.BiFunction
andThen
Methods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ChoicesParser
choices, verifyChoice
Methods 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
null
if no minimum. - Implementation Requirements:
- The default is
null
.
-
maximum
The maximum value allowed (inclusive).- Returns:
- The value, or
null
if 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:ArgumentParser
Validates the raw value before parsing.- Specified by:
validateRaw
in interfaceArgumentParser<P extends @NonNull Number & Comparable<P>,
T extends @NonNull Object> - Specified by:
validateRaw
in 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.
-