All Downloads are FREE. Search and download functionalities are using the official Maven repository.

akka.japi.pf.ReceiveBuilder.scala Maven / Gradle / Ivy

There is a newer version: 2.2.6.3
Show newest version
package akka.japi.pf

import scala.runtime.BoxedUnit
import akka.actor.AbstractActor
import akka.actor.AbstractActor.Receive

object ReceiveBuilder {

  def create() : ReceiveBuilder = new ReceiveBuilder()

}

class ReceiveBuilder {

  private var statements: PartialFunction[Any, BoxedUnit] = null

  protected def addStatement(statement : PartialFunction[Any, BoxedUnit]): Unit = {
    if (statements == null)
      statements = statement
    else
      statements = statements.orElse(statement)
  }

  def build() : Receive = {
    val empty = CaseStatement.empty()

    if (statements == null)
      new Receive(empty)
    else
      new Receive(statements.orElse(empty)) // FIXME why no new Receive(statements)?
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy