Class

com.lightbend.lagom.javadsl.persistence.PersistentEntity

BehaviorBuilder

Related Doc: package PersistentEntity

Permalink

final class BehaviorBuilder extends AnyRef

Mutable builder that is used for defining the event and command handlers. Use [#build] to create the immutable Behavior.

Attributes
protected
Source
PersistentEntity.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BehaviorBuilder
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BehaviorBuilder(state: State)

    Permalink
  2. new BehaviorBuilder(state: State, evtHandlers: Map[Class[_ <: Event], Function[_ <: Event, Behavior]], cmdHandlers: Map[Class[_ <: Command], BiFunction[_ <: Command, CommandContext[Any], Persist[_ <: Event]]])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to any2stringadd[BehaviorBuilder] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (BehaviorBuilder, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to ArrowAssoc[BehaviorBuilder] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def build(): Behavior

    Permalink

    Construct the corresponding immutable Behavior.

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def ensuring(cond: (BehaviorBuilder) ⇒ Boolean, msg: ⇒ Any): BehaviorBuilder

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to Ensuring[BehaviorBuilder] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (BehaviorBuilder) ⇒ Boolean): BehaviorBuilder

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to Ensuring[BehaviorBuilder] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): BehaviorBuilder

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to Ensuring[BehaviorBuilder] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): BehaviorBuilder

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to Ensuring[BehaviorBuilder] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to StringFormat[BehaviorBuilder] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def getState(): State

    Permalink
  19. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def removeCommandHandler(commandClass: Class[_ <: Command]): Unit

    Permalink

    Remove a command handler for a given command class.

  25. def removeEventHandler(eventClass: Class[_ <: Event]): Unit

    Permalink

    Remove an event handler for a given event class.

  26. def setCommandHandler[R, A <: Command with ReplyType[R]](commandClass: Class[A], handler: BiFunction[A, CommandContext[R], Persist[_ <: Event]]): Unit

    Permalink

    Register a command handler for a given command class.

    Register a command handler for a given command class.

    The handler function is supposed to return a Persist directive that defines what event or events, if any, to persist. Use the thenPersist, thenPersistAll or done methods of the context that is passed to the handler function to create the Persist directive.

    After persisting an event external side effects can be performed in the afterPersist function that can be defined when creating the Persist directive. A typical side effect is to reply to the request to confirm that it was performed successfully. Replies are sent with the reply method of the context that is passed to the command handler function.

    The handler function may validate the incoming command and reject it by sending a reply and returning ctx.done().

  27. def setEventHandler[A <: Event](eventClass: Class[A], handler: Function[A, State]): Unit

    Permalink

    Register an event handler for a given event class.

    Register an event handler for a given event class. The handler function is supposed to return the new state after applying the event to the current state. Current state can be accessed with the state method of the PersistentEntity.

  28. def setEventHandlerChangingBehavior[A <: Event](eventClass: Class[A], handler: Function[A, Behavior]): Unit

    Permalink

    Register an event handler that is updating the behavior for a given event class.

    Register an event handler that is updating the behavior for a given event class. The handler function is supposed to return the new behavior after applying the event to the current state. Current behavior can be accessed with the behavior method of the PersistentEntity.

  29. def setReadOnlyCommandHandler[R, A <: Command with ReplyType[R]](commandClass: Class[A], handler: BiConsumer[A, ReadOnlyCommandContext[R]]): Unit

    Permalink

    Register a read-only command handler for a given command class.

    Register a read-only command handler for a given command class. A read-only command handler does not persist events (i.e. it does not change state) but it may perform side effects, such as replying to the request. Replies are sent with the reply method of the context that is passed to the command handler function.

  30. def setState(state: State): Unit

    Permalink
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def [B](y: B): (BehaviorBuilder, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from BehaviorBuilder to ArrowAssoc[BehaviorBuilder] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from BehaviorBuilder to any2stringadd[BehaviorBuilder]

Inherited by implicit conversion StringFormat from BehaviorBuilder to StringFormat[BehaviorBuilder]

Inherited by implicit conversion Ensuring from BehaviorBuilder to Ensuring[BehaviorBuilder]

Inherited by implicit conversion ArrowAssoc from BehaviorBuilder to ArrowAssoc[BehaviorBuilder]

Ungrouped