Class CompositeParser<T>
- java.lang.Object
-
- software.amazon.awssdk.codegen.jmespath.parser.util.CompositeParser<T>
-
- All Implemented Interfaces:
Parser<T>
public final class CompositeParser<T> extends Object implements Parser<T>
AParser
that invokes a list of converters, returning the first converter that was successful. This is created usingfirstTry(Parser)
and new converters are added viathenTry(Parser)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> CompositeParser<T>
firstTry(Parser<T> parser)
Create aCompositeParser
that tries the provided parser first.static <T,U>
CompositeParser<U>firstTry(Parser<T> parser, Function<T,U> resultConverter)
Create aCompositeParser
that tries the provided parser first, converting the result of that parser using the provided function.ParseResult<T>
parse(int startPosition, int endPosition)
Parse a JMESPath string between the start position (inclusive) and end position (exclusive).<S> CompositeParser<T>
thenTry(Parser<S> nextParser, Function<S,T> resultConverter)
Create a newCompositeParser
that tries the provided parser after all previous parsers, converting the result of that parser using the provided function.CompositeParser<T>
thenTry(Parser<T> nextParser)
Create a newCompositeParser
that tries the provided parser after all previous parsers.
-
-
-
Method Detail
-
firstTry
public static <T> CompositeParser<T> firstTry(Parser<T> parser)
Create aCompositeParser
that tries the provided parser first.
-
firstTry
public static <T,U> CompositeParser<U> firstTry(Parser<T> parser, Function<T,U> resultConverter)
Create aCompositeParser
that tries the provided parser first, converting the result of that parser using the provided function.
-
thenTry
public CompositeParser<T> thenTry(Parser<T> nextParser)
Create a newCompositeParser
that tries the provided parser after all previous parsers.
-
thenTry
public <S> CompositeParser<T> thenTry(Parser<S> nextParser, Function<S,T> resultConverter)
Create a newCompositeParser
that tries the provided parser after all previous parsers, converting the result of that parser using the provided function.
-
-