Enum DifferenceType

java.lang.Object
java.lang.Enum<DifferenceType>
de.serra.so_dirty.difference.DifferenceType
Alle implementierten Schnittstellen:
Serializable, Comparable<DifferenceType>

public enum DifferenceType extends Enum<DifferenceType>
The kind of difference.

What this means is different depending on what is being compared. In this Table then and now is used to describe the object in the past and present:

The meaning of DifferenceType
SnapshotNode type REFERENCE EQUALITY TYPE_CHANGE KEY_ADDED KEY_REMOVED
Any different sub classes of SnapshotNode Always Always Always
ReferenceSnapshotNode
!then.equals(now)
!then.equals(now)
!then.getClass().equals(now.getClass())
never never
ArraySnapshotNode
then != now
!then.equals(now)
!then.getClass().getComponentType().equals(now.getClass().getComponentType())
never never
ClassSnapshotNode
!then != now
!then.equals(now)
!then.getClass().equals(now.getClass())
never never
MapSnapshotNode
!then != now
!then.equals(now)
!then.getClass().equals(now.getClass())
for (var nowKey : now.keySet()) {
	if (!then.containsKey(nowKey)) {
		return true;
	}
}
return false;
for (var thenKey : then.keySet()) {
	if (!now.containsKey(thenKey)) {
		return true;
	}
}
return false;
In addition to the table there are some special cases:

null diffed against a non null value is always all three difference types. null diffed against null is always none of the difference types.

Autor:
Peter Lamby
  • Enum-Konstanten - Details

    • REFERENCE

      public static final DifferenceType REFERENCE
      The value is different by reference (==).
    • EQUALITY

      public static final DifferenceType EQUALITY
      The value is different by equality (Object.equals(Object).
    • TYPE_CHANGE

      public static final DifferenceType TYPE_CHANGE
      The class of the value changed. This always implies REFERENCE.
    • KEY_ADDED

      public static final DifferenceType KEY_ADDED
      A key was found in a Map that was not there in the previous snapshot.

      The keys are compared by equality.

    • KEY_REMOVED

      public static final DifferenceType KEY_REMOVED
      A key that was previously in a Map is not there anymore.

      The keys are compared by equality.

  • Methodendetails

    • values

      public static DifferenceType[] values()
      Gibt ein Array mit den Konstanten dieses Enum-Typs in der Reihenfolge ihrer Deklaration zurück.
      Gibt zurück:
      ein Array mit den Konstanten dieses Enumerationstyps in der Reihenfolge ihrer Deklaration
    • valueOf

      public static DifferenceType valueOf(String name)
      Gibt die Enumerationskonstante dieses Typs mit dem angegebenen Namen zurück. Die Zeichenfolge muss exakt mit einer ID übereinstimmen, mit der eine Enumerationskonstante in diesem Typ deklariert wird. (Zusätzliche Leerzeichen sind nicht zulässig.)
      Parameter:
      name - Name der zurückzugebenden Enumerationskonstante.
      Gibt zurück:
      Enumerationskonstante mit dem angegebenen Namen
      Löst aus:
      IllegalArgumentException - wenn dieser Enumerationstyp keine Konstante mit dem angegebenen Namen enthält
      NullPointerException - wenn das Argument nicht angegeben wird