I
- the input type, that this PartialFunction to be applied to
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.public final class UnitPFBuilder<I>
extends java.lang.Object
PartialFunction
.
This is a specialized version of PFBuilder
to map java
void methods to BoxedUnit
.Modifier and Type | Field and Description |
---|---|
protected scala.PartialFunction<F,T> |
statements |
Constructor and Description |
---|
UnitPFBuilder()
Create a UnitPFBuilder.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addStatement(scala.PartialFunction<F,T> statement) |
scala.PartialFunction<F,T> |
build()
Build a
PartialFunction from this builder. |
<P> UnitPFBuilder<I> |
match(java.lang.Class<? extends P> type,
FI.TypedPredicate<? extends P> predicate,
FI.UnitApply<? extends P> apply)
Add a new case statement to this builder.
|
<P> UnitPFBuilder<I> |
match(java.lang.Class<? extends P> type,
FI.UnitApply<? extends 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.
|
public <P> UnitPFBuilder<I> match(java.lang.Class<? extends P> type, FI.UnitApply<? extends P> apply)
type
- a type to match the argument againstapply
- an action to apply to the argument if the type matchespublic <P> UnitPFBuilder<I> match(java.lang.Class<? extends P> type, FI.TypedPredicate<? extends P> predicate, FI.UnitApply<? extends P> apply)
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 truepublic <P> UnitPFBuilder<I> matchEquals(P object, FI.UnitApply<P> apply)
object
- the object to compare equals withapply
- an action to apply to the argument if the object compares equalpublic <P> UnitPFBuilder<I> matchEquals(P object, FI.TypedPredicate<P> predicate, FI.UnitApply<P> apply)
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 equalpublic UnitPFBuilder<I> matchAny(FI.UnitApply<java.lang.Object> apply)
apply
- an action to apply to the argumentprotected void addStatement(scala.PartialFunction<F,T> statement)
public scala.PartialFunction<F,T> build()
PartialFunction
from this builder.
After this call the builder will be reset.