public final class IntMismatch
extends java.lang.Object
int
values in ValueMismatch
es.Modifier and Type | Method and Description |
---|---|
static io.spine.change.ValueMismatch |
expectedNonZero(int expected,
int newValue,
int version)
Creates
ValueMismatch for the case of discovering zero value,
when a non zero amount was expected by a command. |
static io.spine.change.ValueMismatch |
expectedZero(int actual,
int newValue,
int version)
Creates
ValueMismatch for the case of discovering not zero value,
when a zero amount was expected by a command. |
static io.spine.change.ValueMismatch |
of(int expected,
int actual,
int newValue,
int version)
Creates a new instance of
ValueMismatch with the passed values
for an integer attribute. |
static io.spine.change.ValueMismatch |
unexpectedValue(int expected,
int actual,
int newValue,
int version)
Creates
ValueMismatch for the case of discovering a value
different than by a command. |
static int |
unpackActual(io.spine.change.ValueMismatch mismatch)
Obtains actual int value from the passed mismatch.
|
static int |
unpackExpected(io.spine.change.ValueMismatch mismatch)
Obtains expected int value from the passed mismatch.
|
static int |
unpackNewValue(io.spine.change.ValueMismatch mismatch)
Obtains new int value from the passed mismatch.
|
public static io.spine.change.ValueMismatch expectedZero(int actual, int newValue, int version)
ValueMismatch
for the case of discovering not zero value,
when a zero amount was expected by a command.actual
- the value discovered instead of zeronewValue
- the new value requested in the commandversion
- the version of the entity in which the mismatch is discoveredValueMismatch
instancepublic static io.spine.change.ValueMismatch expectedNonZero(int expected, int newValue, int version)
ValueMismatch
for the case of discovering zero value,
when a non zero amount was expected by a command.expected
- the value of the field that the command wanted to clearnewValue
- the new value requested in the commandversion
- the version of the entity in which the mismatch is discoveredValueMismatch
instancepublic static io.spine.change.ValueMismatch unexpectedValue(int expected, int actual, int 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 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 of(int expected, int actual, int newValue, int version)
ValueMismatch
with the passed values
for an integer attribute.public static int unpackExpected(io.spine.change.ValueMismatch mismatch)
java.lang.RuntimeException
- if the passed instance represent a mismatch of non-int valuespublic static int unpackActual(io.spine.change.ValueMismatch mismatch)
java.lang.RuntimeException
- if the passed instance represent a mismatch of non-int valuespublic static int unpackNewValue(io.spine.change.ValueMismatch mismatch)
java.lang.RuntimeException
- if the passed instance represent a mismatch of non-int values