Interface DifferenceComputing<T>

Type Parameters:
T - Value type, same as in ValueEngineer

public interface DifferenceComputing<T>
Aspect for ValueEngineers providing means to compute differences between values.
Since:
4.2.414
See Also:
  • Field Details

  • Method Details

    • computeDifferences

      @NotNull @NotNull List<Difference> computeDifferences(@NotNull T actualValue, @NotNull T oldValue)
      Compute the list of differences between the two provided values. The cases where one of the parameters is null is handled by the framework which will create a list with one difference, containing the actualvalue 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:

      1. NONE - If a detail hasn't changed.
      2. DELETED - If a detail has been removed.
      3. INSERTED - If a detail has been inserted.
      4. CHANGED - If a detail has been changed.
      E.g. of 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