public class PersistentEntity.Behavior
extends Object
implements scala.Product, scala.Serializable
Behavior
is an immutable class. Use the mutable BehaviorBuilder
for defining command and event handlers.Constructor and Description |
---|
Behavior(State state,
scala.collection.immutable.Map<Class<? extends Event>,java.util.function.Function<? extends Event,PersistentEntity.Behavior>> eventHandlers,
scala.collection.immutable.Map<Class<? extends Command>,java.util.function.BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> commandHandlers) |
Modifier and Type | Method and Description |
---|---|
com.lightbend.lagom.javadsl.persistence.PersistentEntity.BehaviorBuilder |
builder()
Create a
BehaviorBuilder that corresponds to this Behavior , i.e. |
scala.collection.immutable.Map<Class<? extends Command>,java.util.function.BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> |
commandHandlers() |
scala.collection.immutable.Map<Class<? extends Event>,java.util.function.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>,java.util.function.Function<? extends Event,PersistentEntity.Behavior>> eventHandlers, scala.collection.immutable.Map<Class<? extends Command>,java.util.function.BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> commandHandlers)
public State state()
public scala.collection.immutable.Map<Class<? extends Event>,java.util.function.Function<? extends Event,PersistentEntity.Behavior>> eventHandlers()
public scala.collection.immutable.Map<Class<? extends Command>,java.util.function.BiFunction<? extends Command,PersistentEntity.CommandContext<Object>,PersistentEntity.Persist<? extends Event>>> commandHandlers()
public PersistentEntity.Behavior withState(State newState)
public com.lightbend.lagom.javadsl.persistence.PersistentEntity.BehaviorBuilder builder()
BehaviorBuilder
that corresponds to this Behavior
, i.e. the builder
is populated with same state, same event and command handler functions.