Package akka.actor.typed
Class Behavior.BehaviorDecorators<Inner>
- java.lang.Object
-
- scala.AnyVal
-
- akka.actor.typed.Behavior.BehaviorDecorators<Inner>
-
-
Constructor Summary
Constructors Constructor Description BehaviorDecorators(Behavior<Inner> behavior)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Behavior<Inner>
behavior()
boolean
equals(java.lang.Object x$1)
int
hashCode()
<Outer> Behavior<Outer>
transformMessages(scala.PartialFunction<Outer,Inner> matcher, scala.reflect.ClassTag<Outer> evidence$1)
Transform the incoming messages by placing a funnel in front of the wrappedBehavior
: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy.
-
-
-
Method Detail
-
transformMessages
public <Outer> Behavior<Outer> transformMessages(scala.PartialFunction<Outer,Inner> matcher, scala.reflect.ClassTag<Outer> evidence$1)
Transform the incoming messages by placing a funnel in front of the wrappedBehavior
: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy. Signals are not transformed.Example:
val b: Behavior[Number] = Behaviors .receive[String] { (ctx, msg) => println(msg) Behaviors.same } .transformMessages[Number] { case b: BigDecimal => s"BigDecimal($b)" case i: BigInt => s"BigInteger($i)" // all other kinds of Number will be `unhandled` }
The
ClassTag
forOuter
ensures that only messages of this class or a subclass thereof will be intercepted. Other message types (e.g. a private protocol) will bypass the interceptor and be continue to the inner behavior untouched.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x$1)
- Overrides:
equals
in classjava.lang.Object
-
-