Class 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>>
java.lang.Object
dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction.PostParser<R,I,T,P1,P2>
- Type Parameters:
R
- The original raw type.I
- The intermediary type output by the first parser and consumed by the second.T
- The final output type.P1
- The type of the first parser.P2
- The type of the second parser.
- All Implemented Interfaces:
ParserFunction<R,
,T> BiFunction<CommandContext,
R, Mono<T>>
- Direct Known Subclasses:
UrlParser.PostParser
public static class 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>>
extends Object
implements ParserFunction<R,T>
A composed parser that first applies this parser to one parser, and then applies the
results to a second parser. If parsing with either parser throws an exception, it is
relayed to the caller of the composed parser.
- Since:
- 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>> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparse
(CommandContext context, R raw) Parses the given raw argument from the user into the corresponding value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
Methods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
apply, then
-
Field Details
-
parser
The first parser to apply. -
postParser
The second parser to apply.
-
-
Constructor Details
-
PostParser
Creates a new instance.- Parameters:
parser
- The first parser to apply.postParser
- The second parser to apply.
-
-
Method Details
-
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,
I 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.
-