T
- Value type, same as in ValueEngineer
public interface DifferenceComputing<T>
ValueEngineer
s providing means to compute differences between values.Difference
Modifier and Type | Field and Description |
---|---|
static ValueEngineerAspectType<DifferenceComputing<?>> |
TYPE
Aspect for
ValueEngineer s providing means to compute differences between values. |
Modifier and Type | Method and Description |
---|---|
List<Difference> |
computeDifferences(T actualValue,
T oldValue)
Compute the list of differences between the two provided values.
|
static final ValueEngineerAspectType<DifferenceComputing<?>> TYPE
ValueEngineer
s providing means to compute differences between values.@NotNull List<Difference> computeDifferences(@NotNull T actualValue, @NotNull T oldValue)
null
is handled by the framework which will create a list with one difference, containing the actual
value as contrast
.
If the two values have no differences, implementors could return an empty list
.
For computing differences on the values details (e.g., for two strings), the following guideline describes the meaning of the types of modification:
NONE
- If a detail hasn't changed.DELETED
- If a detail has been removed.INSERTED
- If a detail has been inserted.CHANGED
- If a detail has been changed.actualValue == "This is the actual value!"
, oldValue == "This is the old value."
a list with one entry could be returned:
return Collections.singletonList(new Difference(actualValue, CHANGED));Or a more detailed list of differences:
return Arrays.asList( new Difference("This is the ", NONE), new Difference("actual", INSERTED), new Difference("old", DELETED), new Difference(" value", NONE), new Difference("!", INSERTED), new Difference(".", DELETED));
actualValue
- The actual value.oldValue
- The former value.Copyright © 2014 e-Spirit AG. All Rights Reserved. Build 5.0_BETA.500