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