Class AggregateParserPairBuilder<C,U,V,O>
java.lang.Object
org.incendo.cloud.parser.aggregate.AggregateParserPairBuilder<C,U,V,O>
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAggregateParserPairBuilder(TypedCommandComponent<C, U> first, TypedCommandComponent<C, V> second, AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, TypeToken<O> outType) Creates a newAggregateParserPairBuilderwith the given components and mapper. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds anAggregateParserfrom the current state of the builder.static <C,U, V> AggregateParserPairBuilder.Mapper <C, U, V, Pair<U, V>> Creates the default mapper that simply returns aPairof the two input values.static <C,U, V, O>
@NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> directMapper(@NonNull AggregateParserPairBuilder.Mapper.DirectSuccessMapper<C, U, V, O> mapper) Helper function to create a direct success mapper.<O1> AggregateParserPairBuilder<C, U, V, O1> withDirectMapper(@NonNull TypeToken<O1> outType, @NonNull AggregateParserPairBuilder.Mapper.DirectSuccessMapper<C, U, V, O1> mapper) Creates a newAggregateParserPairBuilderwith the given mapper.<O1> AggregateParserPairBuilder<C, U, V, O1> withMapper(@NonNull TypeToken<O1> outType, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O1> mapper) Creates a newAggregateParserPairBuilderwith the given mapper.
-
Constructor Details
-
AggregateParserPairBuilder
public AggregateParserPairBuilder(TypedCommandComponent<C, U> first, TypedCommandComponent<C, V> second, AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, TypeToken<O> outType) Creates a newAggregateParserPairBuilderwith the given components and mapper.- Parameters:
first- the first componentsecond- the second componentmapper- the mapperoutType- the output type
-
-
Method Details
-
defaultMapper
Creates the default mapper that simply returns aPairof the two input values.- Type Parameters:
C- the command sender typeU- the first typeV- the second type- Returns:
- a default mapper that returns a
Pairof the two input values
-
withMapper
public <O1> AggregateParserPairBuilder<C,U, withMapperV, O1> (@NonNull TypeToken<O1> outType, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O1> mapper) Creates a newAggregateParserPairBuilderwith the given mapper.- Type Parameters:
O1- the new output type- Parameters:
outType- the new output typemapper- the mapper- Returns:
- a new
AggregateParserPairBuilderwith the given mapper
-
withDirectMapper
public <O1> AggregateParserPairBuilder<C,U, withDirectMapperV, O1> (@NonNull TypeToken<O1> outType, @NonNull AggregateParserPairBuilder.Mapper.DirectSuccessMapper<C, U, V, O1> mapper) Creates a newAggregateParserPairBuilderwith the given mapper.- Type Parameters:
O1- the new output type- Parameters:
outType- the new output typemapper- the mapper- Returns:
- a new
AggregateParserPairBuilderwith the given mapper
-
build
Builds anAggregateParserfrom the current state of the builder.- Returns:
- the built
AggregateParser
-
directMapper
public static <C,U, @NonNull AggregateParserPairBuilder.Mapper<C,V, O> U, directMapperV, O> (@NonNull AggregateParserPairBuilder.Mapper.DirectSuccessMapper<C, U, V, O> mapper) Helper function to create a direct success mapper.- Type Parameters:
C- command sender typeU- first component typeV- second component typeO- output type- Parameters:
mapper- mapper- Returns:
- mapper
-