public class PersistentEntity.Behavior extends Object implements scala.Product, scala.Serializable
Behavior
is an immutable class. Use the mutable PersistentEntity.BehaviorBuilder
for defining command and event handlers.Constructor and Description |
---|
Behavior(State state,
scala.collection.immutable.Map<Class<? extends Event>,Function<? extends Event,PersistentEntity.Behavior>> eventHandlers,
scala.collection.immutable.Map<Class<? extends Command>,BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> commandHandlers) |
Modifier and Type | Method and Description |
---|---|
PersistentEntity.BehaviorBuilder |
builder()
Create a
BehaviorBuilder that corresponds to this Behavior , i.e. |
scala.collection.immutable.Map<Class<? extends Command>,BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> |
commandHandlers() |
scala.collection.immutable.Map<Class<? extends Event>,Function<? extends Event,PersistentEntity.Behavior>> |
eventHandlers() |
State |
state() |
PersistentEntity.Behavior |
withState(State newState) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public Behavior(State state, scala.collection.immutable.Map<Class<? extends Event>,Function<? extends Event,PersistentEntity.Behavior>> eventHandlers, scala.collection.immutable.Map<Class<? extends Command>,BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> commandHandlers)
public State state()
public scala.collection.immutable.Map<Class<? extends Event>,Function<? extends Event,PersistentEntity.Behavior>> eventHandlers()
public scala.collection.immutable.Map<Class<? extends Command>,BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> commandHandlers()
public PersistentEntity.Behavior withState(State newState)
public PersistentEntity.BehaviorBuilder builder()
BehaviorBuilder
that corresponds to this Behavior
, i.e. the builder
is populated with same state, same event and command handler functions.