Package org.apache.pekko.japi.pf
Class UnitPFBuilder<I>
java.lang.Object
org.apache.pekko.japi.pf.UnitPFBuilder<I>
- Type Parameters:
I- the input type, that this PartialFunction to be applied to
A builder for
PartialFunction. This is a specialized version of PFBuilder
to map java void methods to BoxedUnit.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddStatement(scala.PartialFunction<I, scala.runtime.BoxedUnit> statement) scala.PartialFunction<I,scala.runtime.BoxedUnit> build()Build aPartialFunctionfrom this builder.<P> UnitPFBuilder<I>Add a new case statement to this builder.<P> UnitPFBuilder<I>Add a new case statement to this builder.Add a new case statement to this builder, that matches any argument.<P> UnitPFBuilder<I>matchEquals(P object, Predicate<P> predicate, Procedure<P> apply) Add a new case statement to this builder.<P> UnitPFBuilder<I>matchEquals(P object, Procedure<P> apply) Add a new case statement to this builder.matchUnchecked(Class<?> type, Predicate<?> predicate, Procedure<?> apply) Add a new case statement to this builder without compile time type check.matchUnchecked(Class<?> type, Procedure<?> apply) Add a new case statement to this builder without compile time type check.
-
Field Details
-
statements
-
-
Constructor Details
-
UnitPFBuilder
public UnitPFBuilder()Create a UnitPFBuilder.
-
-
Method Details
-
match
Add a new case statement to this builder.- Parameters:
type- a type to match the argument againstapply- an action to apply to the argument if the type matches- Returns:
- a builder with the case statement added
-
matchUnchecked
Add a new case statement to this builder without compile time type check. Should normally not be used, but when matching on class with generic type argument it can be useful, e.g.List.classand(List<String> list) -> {}.- Parameters:
type- a type to match the argument againstapply- an action to apply to the argument if the type matches- Returns:
- a builder with the case statement added
-
match
Add a new case statement to this builder.- Parameters:
type- a type to match the argument againstpredicate- a predicate that will be evaluated on the argument if the type matchesapply- an action to apply to the argument if the type matches and the predicate returns true- Returns:
- a builder with the case statement added
-
matchUnchecked
Add a new case statement to this builder without compile time type check. Should normally not be used, but when matching on class with generic type argument it can be useful, e.g.List.classand(List<String> list) -> {}.- Parameters:
type- a type to match the argument againstpredicate- a predicate that will be evaluated on the argument if the type matchesapply- an action to apply to the argument if the type matches and the predicate returns true- Returns:
- a builder with the case statement added
-
matchEquals
Add a new case statement to this builder.- Parameters:
object- the object to compare equals withapply- an action to apply to the argument if the object compares equal- Returns:
- a builder with the case statement added
-
matchEquals
Add a new case statement to this builder.- Parameters:
object- the object to compare equals withpredicate- a predicate that will be evaluated on the argument if the object compares equalapply- an action to apply to the argument if the object compares equal- Returns:
- a builder with the case statement added
-
matchAny
Add a new case statement to this builder, that matches any argument.- Parameters:
apply- an action to apply to the argument- Returns:
- a builder with the case statement added
-
addStatement
-
build
Build aPartialFunctionfrom this builder. After this call the builder will be reset.- Returns:
- a PartialFunction for this builder.
-