Skip to content

Custom Dirty Check

Jan Wiemer edited this page Dec 30, 2020 · 2 revisions

Custom Dirty Check

In the Dirty Check chapter it was already mentioned that there is no dirty check by default. It was also described how to configure a standard extension doing a dirty check for objects implementing the JacisDirtyTrackingObject interface. This dirty check extension is enabled by passing an instance of the StoreEntryBasedDirtyCheck to the setObjectBasedDirtyCheck method of the JacisObjectTypeSpec.

It is also possible to provide other implementations of the dirty check (e.g. checking for equality by reflection). For this purpose an instance of another dirty check extension class (implementing the JacisDirtyTrackingObject interface) has to be set at the object type specification. The extension class simply has to implement the isDirty getting the original value (the value from the time when the object is cloned to the TX-view) and the current value of the object:

public interface JacisDirtyCheck<K, TV> { // K: key type, TV: object value type
  boolean isDirty(K key, TV originalValue, TV currentValue);
}

Clone this wiki locally