public final class DoubleMismatch
extends java.lang.Object
double
values in ValueMismatch
es.Modifier and Type | Method and Description |
---|---|
static io.spine.change.ValueMismatch |
expectedNonZero(double expected,
double 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(double actual,
double 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(double expected,
double actual,
double newValue,
int version)
Creates a new instance of
ValueMismatch with the passed values
for a double attribute. |
static io.spine.change.ValueMismatch |
unexpectedValue(double expected,
double actual,
double newValue,
int version)
Creates
ValueMismatch for the case of discovering a value
different than by a command. |
static double |
unpackActual(io.spine.change.ValueMismatch mismatch)
Obtains actual double value from the passed mismatch.
|
static double |
unpackExpected(io.spine.change.ValueMismatch mismatch)
Obtains expected double value from the passed mismatch.
|
static double |
unpackNewValue(io.spine.change.ValueMismatch mismatch)
Obtains new double value from the passed mismatch.
|
public static io.spine.change.ValueMismatch expectedZero(double actual, double 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(double expected, double 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(double expected, double actual, double 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(double expected, double actual, double newValue, int version)
ValueMismatch
with the passed values
for a double attribute.public static double unpackExpected(io.spine.change.ValueMismatch mismatch)
java.lang.RuntimeException
- if the passed instance represent a mismatch of non-double valuespublic static double unpackActual(io.spine.change.ValueMismatch mismatch)
java.lang.RuntimeException
- if the passed instance represent a mismatch of non-double valuespublic static double unpackNewValue(io.spine.change.ValueMismatch mismatch)
java.lang.RuntimeException
- if the passed instance represent a mismatch of non-double values