public final class MessageMismatch
extends java.lang.Object
ValueMismatch
es for Message
values.Modifier and Type | Method and Description |
---|---|
static io.spine.change.ValueMismatch |
expectedDefault(com.google.protobuf.Message actual,
com.google.protobuf.Message newValue,
int version)
Creates
ValueMismatch for the case of discovering a non-default value,
when the default value was expected by a command. |
static io.spine.change.ValueMismatch |
expectedNotDefault(com.google.protobuf.Message expected,
int version)
Creates a
ValueMismatch for a command that wanted to clear a value,
but discovered that the field already has the default value. |
static io.spine.change.ValueMismatch |
expectedNotDefault(com.google.protobuf.Message expected,
com.google.protobuf.Message newValue,
int version)
Creates a
ValueMismatch for a command that wanted to change a field value,
but discovered that the field has the default value. |
static io.spine.change.ValueMismatch |
unexpectedValue(com.google.protobuf.Message expected,
com.google.protobuf.Message actual,
com.google.protobuf.Message newValue,
int version)
Creates
ValueMismatch for the case of discovering a value
different than by a command. |
static com.google.protobuf.Message |
unpackActual(io.spine.change.ValueMismatch mismatch)
Obtains actual value as a
Message from the passed mismatch. |
static com.google.protobuf.Message |
unpackExpected(io.spine.change.ValueMismatch mismatch)
Obtains expected value as a
Message from the passed mismatch. |
static com.google.protobuf.Message |
unpackNewValue(io.spine.change.ValueMismatch mismatch)
Obtains new value as a
Message from the passed mismatch. |
public static io.spine.change.ValueMismatch expectedDefault(com.google.protobuf.Message actual, com.google.protobuf.Message newValue, int version)
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 commandversion
- the version of the entity in which the mismatch is discoveredValueMismatch
instancepublic static io.spine.change.ValueMismatch expectedNotDefault(com.google.protobuf.Message expected, int version)
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 clearversion
- the version of the entity in which the mismatch is discoveredValueMismatch
instancepublic static io.spine.change.ValueMismatch expectedNotDefault(com.google.protobuf.Message expected, com.google.protobuf.Message newValue, int version)
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 setversion
- the version of the entity in which the mismatch is discoveredValueMismatch
instancepublic static io.spine.change.ValueMismatch unexpectedValue(com.google.protobuf.Message expected, com.google.protobuf.Message actual, com.google.protobuf.Message newValue, int version)
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 commandversion
- the version of the entity in which the mismatch is discoveredValueMismatch
instancepublic static com.google.protobuf.Message unpackExpected(io.spine.change.ValueMismatch mismatch)
Message
from the passed mismatch.java.lang.RuntimeException
- if the passed instance represent a mismatch of
non-Message
valuespublic static com.google.protobuf.Message unpackActual(io.spine.change.ValueMismatch mismatch)
Message
from the passed mismatch.java.lang.RuntimeException
- if the passed instance represent a mismatch of
non-Message
valuespublic static com.google.protobuf.Message unpackNewValue(io.spine.change.ValueMismatch mismatch)
Message
from the passed mismatch.java.lang.RuntimeException
- if the passed instance represent a mismatch of
non-Message
values