Package org.apache.pekko.japi.pf
Class UnitMatch<I>
java.lang.Object
org.apache.pekko.japi.pf.UnitMatch<I>
- Type Parameters:
I- the input type, that this PartialFunction will be applied to
Version of
PartialFunction that can be built during runtime from Java. This is a
specialized version of UnitMatch to map java void methods to BoxedUnit.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final scala.PartialFunction<I,scala.runtime.BoxedUnit> -
Method Summary
Modifier and TypeMethodDescriptionscala.PartialFunction<I,scala.runtime.BoxedUnit> asPF()Turn thisMatchinto aPartialFunction.static <F> UnitMatch<F>create(UnitPFBuilder<F> builder) Create aUnitMatchfrom the builder.voidConvenience function to make the Java code more readable.static <F,P> UnitPFBuilder<F> Convenience function to create aUnitPFBuilderwith the first case statement added.static <F,P> UnitPFBuilder<F> Convenience function to create aUnitPFBuilderwith the first case statement added.static <F> UnitPFBuilder<F>Convenience function to create aUnitPFBuilderwith the first case statement added.static <F,P> UnitPFBuilder<F> matchEquals(P object, Predicate<P> predicate, Procedure<P> apply) Convenience function to create aUnitPFBuilderwith the first case statement added.static <F,P> UnitPFBuilder<F> matchEquals(P object, Procedure<P> apply) Convenience function to create aUnitPFBuilderwith the first case statement added.static <F,P> UnitPFBuilder<F> matchUnchecked(Class<?> type, Predicate<?> predicate, Procedure<?> apply) Convenience function to create aUnitPFBuilderwith the first case statement added.static UnitPFBuilder<Object>matchUnchecked(Class<?> type, Procedure<?> apply) Convenience function to create aUnitPFBuilderwith the first case statement added.
-
Field Details
-
statements
-
-
Method Details
-
match
Convenience function to create aUnitPFBuilderwith the first case statement added.- 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
- See Also:
-
matchUnchecked
Convenience function to create aUnitPFBuilderwith the first case statement added. Should normally not be used. -
match
public static <F,P> UnitPFBuilder<F> match(Class<P> type, Predicate<P> predicate, Procedure<P> apply) Convenience function to create aUnitPFBuilderwith the first case statement added.- 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 and predicate matches- Returns:
- a builder with the case statement added
- See Also:
-
matchUnchecked
public static <F,P> UnitPFBuilder<F> matchUnchecked(Class<?> type, Predicate<?> predicate, Procedure<?> apply) Convenience function to create aUnitPFBuilderwith the first case statement added. Should normally not be used. -
matchEquals
Convenience function to create aUnitPFBuilderwith the first case statement added.- 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
- See Also:
-
matchEquals
public static <F,P> UnitPFBuilder<F> matchEquals(P object, Predicate<P> predicate, Procedure<P> apply) Convenience function to create aUnitPFBuilderwith the first case statement added.- Parameters:
object- the object to compare equals withpredicate- a predicate that will be evaluated on the argument the object compares equalapply- an action to apply to the argument if the object compares equal- Returns:
- a builder with the case statement added
- See Also:
-
matchAny
Convenience function to create aUnitPFBuilderwith the first case statement added.- Parameters:
apply- an action to apply to the argument- Returns:
- a builder with the case statement added
- See Also:
-
create
Create aUnitMatchfrom the builder.- Parameters:
builder- a builder representing the partial function- Returns:
- a
UnitMatchthat can be reused
-
match
Convenience function to make the Java code more readable.UnitMatcher<X> matcher = UnitMatcher.create(...); matcher.match(obj);- Parameters:
i- the argument to apply the match to- Throws:
scala.MatchError- if there is no match
-
asPF
Turn thisMatchinto aPartialFunction.- Returns:
- a partial function representation ot his
Match
-