Package org.incendo.cloud.parser
Interface ParserDescriptor<C,T>
- All Known Subinterfaces:
AggregateParser<C,O>
-
Method Summary
Modifier and TypeMethodDescriptiondefault <O> @NonNull ParserDescriptor<C, O> Create a descriptor for aflatMappedparser.default <O> @NonNull ParserDescriptor<C, O> Create a descriptor for aflatMappedparser.default <O> @NonNull ParserDescriptor<C, O> flatMapSuccess(@NonNull TypeToken<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<ArgumentParseResult<O>>> mapper) Create a descriptor for aflatMappedparser.default <O> @NonNull ParserDescriptor<C, O> flatMapSuccess(@NonNull Class<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<ArgumentParseResult<O>>> mapper) Create a descriptor for aflatMappedparser.default <O> @NonNull ParserDescriptor<C, O> mapSuccess(@NonNull TypeToken<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<O>> mapper) Create a descriptor for amappedparser.default <O> @NonNull ParserDescriptor<C, O> mapSuccess(@NonNull Class<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<O>> mapper) Create a descriptor for amappedparser.static <C,T> @NonNull ParserDescriptor <C, T> of(@NonNull ArgumentParser<C, T> parser, @NonNull TypeToken<T> valueType) Creates a new parser descriptor.static <C,T> @NonNull ParserDescriptor <C, T> of(@NonNull ArgumentParser<C, T> parser, @NonNull Class<T> valueType) Creates a new parser descriptor.parser()Returns the parser.static <C,T> @NonNull ParserDescriptor <C, T> parserDescriptor(@NonNull ArgumentParser<C, T> parser, @NonNull TypeToken<T> valueType) Creates a new parser descriptor.static <C,T> @NonNull ParserDescriptor <C, T> parserDescriptor(@NonNull ArgumentParser<C, T> parser, @NonNull Class<T> valueType) Creates a new parser descriptor.Returns the type of values produced by the parser.
-
Method Details
-
parser
@NonNull ArgumentParser<C,T> parser()Returns the parser.- Returns:
- the parser
-
valueType
Returns the type of values produced by the parser.- Returns:
- the type of values produced by the parser
-
flatMap
default <O> @NonNull ParserDescriptor<C,O> flatMap(@NonNull TypeToken<O> mappedType, @NonNull MappedArgumentParser.Mapper<C, T, O> mapper) Create a descriptor for aflatMappedparser.- Type Parameters:
O- mapped parser result type- Parameters:
mappedType- mapped parser result typemapper- mapper- Returns:
- mapped parser descriptor
-
flatMap
default <O> @NonNull ParserDescriptor<C,O> flatMap(@NonNull Class<O> mappedType, @NonNull MappedArgumentParser.Mapper<C, T, O> mapper) Create a descriptor for aflatMappedparser.- Type Parameters:
O- mapped parser result type- Parameters:
mappedType- mapped parser result typemapper- mapper- Returns:
- mapped parser descriptor
-
flatMapSuccess
default <O> @NonNull ParserDescriptor<C,O> flatMapSuccess(@NonNull TypeToken<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<ArgumentParseResult<O>>> mapper) Create a descriptor for aflatMappedparser.- Type Parameters:
O- mapped parser result type- Parameters:
mappedType- mapped parser result typemapper- mapper- Returns:
- mapped parser descriptor
-
flatMapSuccess
default <O> @NonNull ParserDescriptor<C,O> flatMapSuccess(@NonNull Class<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<ArgumentParseResult<O>>> mapper) Create a descriptor for aflatMappedparser.- Type Parameters:
O- mapped parser result type- Parameters:
mappedType- mapped parser result typemapper- mapper- Returns:
- mapped parser descriptor
-
mapSuccess
default <O> @NonNull ParserDescriptor<C,O> mapSuccess(@NonNull TypeToken<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<O>> mapper) Create a descriptor for amappedparser.- Type Parameters:
O- mapped parser result type- Parameters:
mappedType- mapped parser result typemapper- mapper- Returns:
- mapped parser descriptor
-
mapSuccess
default <O> @NonNull ParserDescriptor<C,O> mapSuccess(@NonNull Class<O> mappedType, @NonNull BiFunction<CommandContext<C>, T, CompletableFuture<O>> mapper) Create a descriptor for amappedparser.- Type Parameters:
O- mapped parser result type- Parameters:
mappedType- mapped parser result typemapper- mapper- Returns:
- mapped parser descriptor
-
of
static <C,T> @NonNull ParserDescriptor<C,T> of(@NonNull ArgumentParser<C, T> parser, @NonNull TypeToken<T> valueType) Creates a new parser descriptor.- Type Parameters:
C- the command sender typeT- the type of values produced by the parser- Parameters:
parser- the parservalueType- the type of values produced by the parser- Returns:
- the created descriptor
-
of
static <C,T> @NonNull ParserDescriptor<C,T> of(@NonNull ArgumentParser<C, T> parser, @NonNull Class<T> valueType) Creates a new parser descriptor.- Type Parameters:
C- the command sender typeT- the type of values produced by the parser- Parameters:
parser- the parservalueType- the type of values produced by the parser- Returns:
- the created descriptor
-
parserDescriptor
static <C,T> @NonNull ParserDescriptor<C,T> parserDescriptor(@NonNull ArgumentParser<C, T> parser, @NonNull TypeToken<T> valueType) Creates a new parser descriptor.- Type Parameters:
C- the command sender typeT- the type of values produced by the parser- Parameters:
parser- the parservalueType- the type of values produced by the parser- Returns:
- the created descriptor
-
parserDescriptor
static <C,T> @NonNull ParserDescriptor<C,T> parserDescriptor(@NonNull ArgumentParser<C, T> parser, @NonNull Class<T> valueType) Creates a new parser descriptor.- Type Parameters:
C- the command sender typeT- the type of values produced by the parser- Parameters:
parser- the parservalueType- the type of values produced by the parser- Returns:
- the created descriptor
-