- Type Parameters:
T
- The type of argument that is provided.R
- The type of raw argument that is received.
- All Superinterfaces:
BiFunction<CommandContext,
,R, Mono<T>> ParserFunction<R,
T>
- Enclosing class:
- Parsers
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface Parsers.Simple<R extends @NonNull Object,T extends @NonNull Object>
extends ParserFunction<R,T>
A parser that executes synchronously and does not depend on the invocation context.
- Since:
- 1.0
- Version:
- 1.0
-
Nested Class Summary
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>> -
Method Summary
Methods inherited from interface java.util.function.BiFunction
andThen
Methods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
apply, then
-
Method Details
-
parseNow
Parses the given raw argument from the user into the corresponding value.- Parameters:
raw
- The raw argument received from the user.- Returns:
- The parsed argument. If the raw value is invalid, it may
fail with a
InvalidArgumentException
. - Throws:
InvalidArgumentException
- if the given argument is not a valid value.
-
parse
Description copied from interface:ParserFunction
Parses the given raw argument from the user into the corresponding value.- Specified by:
parse
in interfaceParserFunction<R extends @NonNull Object,
T extends @NonNull Object> - Parameters:
context
- The execution context.raw
- The raw argument received from the user.- Returns:
- A Mono that issues the parsed argument. If the raw value is invalid, it may
fail with a
InvalidArgumentException
. May be empty, in which case the value defers to thedefault
(functionally the same as if the argument was missing, but without causing an error if the parameter isrequired
). - Throws:
InvalidArgumentException
- if the given argument is not a valid value.
-