Class UrlParser.PostParser<I extends @NonNull Object,T extends @NonNull Object,P1 extends @NonNull UrlParser<I>,P2 extends @NonNull ParserFunction<I,T>>
java.lang.Object
dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction.PostParser<String,I,T,P1,P2>
dev.sympho.modular_commands.utils.parse.UrlParser.PostParser<I,T,P1,P2>
- Type Parameters:
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<String,,T> UrlParser<T>,BiFunction<CommandContext,String, Mono<T>>
- Direct Known Subclasses:
FunctorUrlParser.PostParser
public static class UrlParser.PostParser<I extends @NonNull Object,T extends @NonNull Object,P1 extends @NonNull UrlParser<I>,P2 extends @NonNull ParserFunction<I,T>>
extends ParserFunction.PostParser<String,I,T,P1,P2>
implements UrlParser<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.
Note that compatibility is defined only by the first 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>> Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.parse.UrlParser
UrlParser.Choice<T extends @NonNull Object>, UrlParser.ChoiceBase<T extends @NonNull Object,P extends UrlParser<T>>, UrlParser.PostParser<I extends @NonNull Object, T extends @NonNull Object, P1 extends @NonNull UrlParser<I>, P2 extends @NonNull ParserFunction<I, T>> -
Field Summary
Fields inherited from class dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction.PostParser
parser, postParser -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction.PostParser
parseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface dev.sympho.modular_commands.api.command.parameter.parse.ParserFunction
apply
-
Constructor Details
-
PostParser
Creates a new instance.- Parameters:
parser- The first parser to apply.postParser- The second parser to apply.
-
-
Method Details
-
supports
Description copied from interface:UrlParserChecks if the given URL is supported by this parser. If this returnsfalse, callingUrlParser.parse(CommandContext, URL)with the same URL will result in an error.Note that the opposite isn't necessarily true; it is possible for this method to return
truefor a given URL whileUrlParser.parse(CommandContext, URL)results in an error. That just means that the basic structure of the URL was detected as being compatible with this parser (for example, having a particular host and/or protocol), but was malformed or a variant that the parser doesn't support. -
parse
Description copied from interface:UrlParserParses the given URL.- Specified by:
parsein interfaceUrlParser<I extends @NonNull Object>- Parameters:
context- The execution context.url- The URL to parse.- Returns:
- The parsed value. May result in a
InvalidArgumentExceptionif the URL is invalid. - Throws:
InvalidArgumentException- if the URL is invalid.
-