java.lang.Object
de.serra.so_dirty.Snapshot<T>
- Typparameter:
T- The type that is being checked for differences.
Creates a snapshot of an java object that can then be compared to another snappshot to check what has changed.
var myObject = new MyObject();
var previous = Snapshot.of(myObject);
// modify myObject here...
var differenceResult = previous.doDiff(myObject);
// depending on MyObject and the modifications you can check for differences
assertTrue(differenceResult.isDifferent("myField"), "Check if myField is different");
- Autor:
- Peter Lamby
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungDiffthisagainstother.Diffthisagainstother.static <T> Snapshot<T>of(@NonNull T val) Create a snapshot ofval.static <T> Snapshot<T>of(@NonNull T val, SnapshotNodeFactory factory) Create a snapshot ofvalusingfactory.static <T> Snapshot<T>Create a snapshot ofval.static <T> Snapshot<T>of(@Nullable T val, Class<T> type, SnapshotNodeFactory factory) Create a snapshot ofvalusingfactory.
-
Methodendetails
-
doDiff
Diffthisagainstother.Convenience method for
Uses the sameSnapshotNodeFactorythat was used forthis.If you want to use a different
SnapshotNodeFactoryusedoDiff(Snapshot).- Parameter:
other- The object to diff against.- Gibt zurück:
- The differences.
-
doDiff
Diffthisagainstother.- Parameter:
other- The snapshot to diff against.- Gibt zurück:
- The differences.
-
of
- Typparameter:
T- The type of val.- Parameter:
val- The value to snapshot.factory- The factory that should be used to create the snapshot.- Gibt zurück:
- The snapshot.
-
of
Create a snapshot ofval.Convenience method for
- Typparameter:
T- The type of val.- Parameter:
val- The value to snapshot.- Gibt zurück:
- The snapshot.
-
of
- Typparameter:
T- The type of val.- Parameter:
val- The Instance to snapshot.type- The type to snapshot.factory- The factory that should be used to create the snapshot.- Gibt zurück:
- The snapshot.
-
of
- Typparameter:
T- The type of val.- Parameter:
val- The Instance to snapshot.type- The type to snapshot.- Gibt zurück:
- The snapshot.
-