Interface DifferenceComputing<T>
- Type Parameters:
T
- Value type, same as inValueEngineer
public interface DifferenceComputing<T>
Aspect for
ValueEngineer
s providing means to compute differences between values.- Since:
- 4.2.414
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ValueEngineerAspectType<DifferenceComputing<?>>
Aspect forValueEngineer
s providing means to compute differences between values. -
Method Summary
Modifier and TypeMethodDescription@NotNull List<Difference>
computeDifferences
(T actualValue, T oldValue) Compute the list of differences between the two provided values.
-
Field Details
-
TYPE
Aspect forValueEngineer
s providing means to compute differences between values.- Since:
- 4.2.414
-
-
Method Details
-
computeDifferences
Compute the list of differences between the two provided values. The cases where one of the parameters isnull
is handled by the framework which will create a list with one difference, containing the actual value ascontrast
.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));
- Parameters:
actualValue
- The actual value.oldValue
- The former value.- Returns:
- A list of difference descriptors.
- Since:
- 4.2.414
-