public abstract class CommandHandlingEntity<I,S extends io.spine.base.EntityState,B extends io.spine.protobuf.ValidatingBuilder<S>> extends TransactionalEntity<I,S,B> implements CommandHandler
@Assign
Entity.GenericParameter
Modifier | Constructor and Description |
---|---|
protected |
CommandHandlingEntity() |
protected |
CommandHandlingEntity(I id)
Creates a new entity with the passed ID.
|
Modifier and Type | Method and Description |
---|---|
protected abstract io.spine.server.dispatch.DispatchOutcome |
dispatchCommand(CommandEnvelope cmd)
Dispatches the passed command to appropriate handler.
|
protected io.spine.change.ValueMismatch |
expectedDefault(com.google.protobuf.Message actual,
com.google.protobuf.Message newValue)
Creates
ValueMismatch for the case of discovering a non-default value
when the default value was expected by a command. |
protected io.spine.change.ValueMismatch |
expectedEmpty(java.lang.String actual,
java.lang.String newValue)
Creates
ValueMismatch for the case of discovering a non-empty value,
when an empty string was expected by a command. |
protected io.spine.change.ValueMismatch |
expectedNotDefault(com.google.protobuf.Message expected)
Creates a
ValueMismatch for a command that wanted to clear a value,
but discovered that the field already has the default value. |
protected io.spine.change.ValueMismatch |
expectedNotDefault(com.google.protobuf.Message expected,
com.google.protobuf.Message newValue)
Creates a
ValueMismatch for a command that wanted to change a field value,
but discovered that the field has the default value. |
protected io.spine.change.ValueMismatch |
expectedNotEmpty(java.lang.String expected)
Creates a
ValueMismatch for a command that wanted to clear a string value
but discovered that the field is already empty. |
com.google.protobuf.Any |
producerId()
The object identity packed into
Any . |
protected io.spine.change.ValueMismatch |
unexpectedValue(com.google.protobuf.Message expected,
com.google.protobuf.Message actual,
com.google.protobuf.Message newValue)
Creates
ValueMismatch for the case of discovering a value different
than by a command. |
protected io.spine.change.ValueMismatch |
unexpectedValue(java.lang.String expected,
java.lang.String actual,
java.lang.String newValue)
Creates
ValueMismatch for the case of discovering a value
different than expected by a command. |
builder, clearRecentHistory, getLifecycleFlags, missingTxMessage, recentHistory, remember, setArchived, setDeleted, setInitialState, tx
afterInvoke, at, beforeInvoke, checkEntityState, checkNotArchived, checkNotDeleted, defaultState, equals, hashCode, id, idAsString, isArchived, isDeleted, lifecycleFlagsChanged, state, toString, version, versionNumber, whenModified
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
nothing, producedEvents, version
isActive, lifecycleFlags
protected CommandHandlingEntity()
protected CommandHandlingEntity(I id)
public com.google.protobuf.Any producerId()
EventProducer
Any
.producerId
in interface EventProducer
protected abstract io.spine.server.dispatch.DispatchOutcome dispatchCommand(CommandEnvelope cmd)
cmd
- the envelope with the command to handleprotected io.spine.change.ValueMismatch expectedDefault(com.google.protobuf.Message actual, com.google.protobuf.Message newValue)
ValueMismatch
for the case of discovering a non-default value
when the default value was expected by a command.actual
- the value discovered instead of the default valuenewValue
- the new value requested in the commandValueMismatch
instanceprotected io.spine.change.ValueMismatch expectedNotDefault(com.google.protobuf.Message expected)
ValueMismatch
for a command that wanted to clear a value,
but discovered that the field already has the default value.expected
- the value of the field that the command wanted to clearValueMismatch
instanceprotected io.spine.change.ValueMismatch expectedNotDefault(com.google.protobuf.Message expected, com.google.protobuf.Message newValue)
ValueMismatch
for a command that wanted to change a field value,
but discovered that the field has the default value.expected
- the value expected by the commandnewValue
- the value the command wanted to setValueMismatch
instanceprotected io.spine.change.ValueMismatch unexpectedValue(com.google.protobuf.Message expected, com.google.protobuf.Message actual, com.google.protobuf.Message newValue)
ValueMismatch
for the case of discovering a value different
than by a command.expected
- the value expected by the commandactual
- the value discovered instead of the expected valuenewValue
- the new value requested in the commandValueMismatch
instanceprotected io.spine.change.ValueMismatch expectedEmpty(java.lang.String actual, java.lang.String newValue)
ValueMismatch
for the case of discovering a non-empty value,
when an empty string was expected by a command.actual
- the value discovered instead of the empty stringnewValue
- the new value requested in the commandValueMismatch
instanceprotected io.spine.change.ValueMismatch expectedNotEmpty(java.lang.String expected)
ValueMismatch
for a command that wanted to clear a string value
but discovered that the field is already empty.expected
- the value of the field that the command wanted to clearprotected io.spine.change.ValueMismatch unexpectedValue(java.lang.String expected, java.lang.String actual, java.lang.String newValue)
ValueMismatch
for the case of discovering a value
different than expected by a command.expected
- the value expected by the commandactual
- the value discovered instead of the expected stringnewValue
- the new value requested in the commandValueMismatch
instance