Class Behavior.BehaviorDecorators<Inner>

  • Enclosing class:
    Behavior<T>

    public static final class Behavior.BehaviorDecorators<Inner>
    extends scala.AnyVal
    • 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 wrapped Behavior: 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&rsquo;s type hierarchy.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BehaviorDecorators

        public BehaviorDecorators​(Behavior<Inner> behavior)
    • 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 wrapped Behavior: 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&rsquo;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(&dollar;b)"
                 case i: BigInt     => s"BigInteger(&dollar;i)"
                 // all other kinds of Number will be `unhandled`
               }
         

        The ClassTag for Outer 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.

        Parameters:
        matcher - (undocumented)
        evidence$1 - (undocumented)
        Returns:
        (undocumented)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Overrides:
        equals in class java.lang.Object