Package akka.japi.pf
Class UnitPFBuilder<I>
- java.lang.Object
-
- akka.japi.pf.UnitPFBuilder<I>
-
- Type Parameters:
I- the input type, that this PartialFunction to be applied to
public final class UnitPFBuilder<I> extends java.lang.ObjectA builder forPartialFunction. This is a specialized version ofPFBuilderto map java void methods toBoxedUnit.
-
-
Constructor Summary
Constructors Constructor Description UnitPFBuilder()Create a UnitPFBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddStatement(scala.PartialFunction<F,T> statement)scala.PartialFunction<F,T>build()Build aPartialFunctionfrom this builder.<P> UnitPFBuilder<I>match(java.lang.Class<P> type, FI.TypedPredicate<P> predicate, FI.UnitApply<P> apply)Add a new case statement to this builder.<P> UnitPFBuilder<I>match(java.lang.Class<P> type, FI.UnitApply<P> apply)Add a new case statement to this builder.UnitPFBuilder<I>matchAny(FI.UnitApply<java.lang.Object> apply)Add a new case statement to this builder, that matches any argument.<P> UnitPFBuilder<I>matchEquals(P object, FI.TypedPredicate<P> predicate, FI.UnitApply<P> apply)Add a new case statement to this builder.<P> UnitPFBuilder<I>matchEquals(P object, FI.UnitApply<P> apply)Add a new case statement to this builder.UnitPFBuilder<I>matchUnchecked(java.lang.Class<?> type, FI.TypedPredicate<?> predicate, FI.UnitApply<?> apply)Add a new case statement to this builder without compile time type check.UnitPFBuilder<I>matchUnchecked(java.lang.Class<?> type, FI.UnitApply<?> apply)Add a new case statement to this builder without compile time type check.
-
-
-
Method Detail
-
match
public <P> UnitPFBuilder<I> match(java.lang.Class<P> type, FI.UnitApply<P> apply)
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
public UnitPFBuilder<I> matchUnchecked(java.lang.Class<?> type, FI.UnitApply<?> apply)
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
public <P> UnitPFBuilder<I> match(java.lang.Class<P> type, FI.TypedPredicate<P> predicate, FI.UnitApply<P> apply)
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
public UnitPFBuilder<I> matchUnchecked(java.lang.Class<?> type, FI.TypedPredicate<?> predicate, FI.UnitApply<?> apply)
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
public <P> UnitPFBuilder<I> matchEquals(P object, FI.UnitApply<P> apply)
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
public <P> UnitPFBuilder<I> matchEquals(P object, FI.TypedPredicate<P> predicate, FI.UnitApply<P> apply)
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
public UnitPFBuilder<I> matchAny(FI.UnitApply<java.lang.Object> apply)
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
protected void addStatement(scala.PartialFunction<F,T> statement)
-
build
public scala.PartialFunction<F,T> build()
Build aPartialFunctionfrom this builder. After this call the builder will be reset.- Returns:
- a PartialFunction for this builder.
-
-