Class Behavior.BehaviorDecorators$

  • Enclosing class:
    Behavior<T>

    public static class Behavior.BehaviorDecorators$
    extends java.lang.Object
    • Constructor Detail

      • BehaviorDecorators$

        public BehaviorDecorators$()
    • Method Detail

      • widen$extension

        public final <U,​T> Behavior<U> widen$extension​(Behavior.BehaviorDecorators<T> $this,
                                                             scala.PartialFunction<U,​T> matcher)
        Widen the wrapped Behavior by placing a funnel in front of it: 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:

        
         receive[String] { (ctx, msg) => println(msg); same }.widen[Number] {
           case b: BigDecimal => s"BigDecimal(&dollar;b)"
           case i: BigInteger => s"BigInteger(&dollar;i)"
           // all other kinds of Number will be `unhandled`
         }
         

        Scheduled messages via TimerScheduler can currently not be used together with widen, see issue #25318.

        Parameters:
        $this - (undocumented)
        matcher - (undocumented)
        Returns:
        (undocumented)