Class Diff

java.lang.Object
org.javers.core.diff.Diff
All Implemented Interfaces:
Serializable

public class Diff extends Object implements Serializable
Diff is a list of changes between two object graphs.

Typically, it is used to capture and trace changes made on domain objects. In this case, diff is done between previous and current state of an object graph.

See Also:
  • Method Details

    • getObjectsByChangeType

      public <C extends Change> List getObjectsByChangeType(Class<C> type)
      Selects new, removed or changed objects
      Throws:
      JaversException - AFFECTED_CDO_IS_NOT_AVAILABLE if diff is restored from a repository
    • getObjectsWithChangedProperty

      public List getObjectsWithChangedProperty(String propertyName)
      Selects objects with changed property for given property name
      Throws:
      JaversException - AFFECTED_CDO_IS_NOT_AVAILABLE if diff is restored from repository,
    • getChanges

      public Changes getChanges()
      Flat list of changes
    • groupByObject

      public List<ChangesByObject> groupByObject()
      Changes grouped by entities
      Since:
      3.9
    • getChanges

      public List<Change> getChanges(Predicate<Change> predicate)
      Changes that satisfies given filter
    • getChangesByType

      public <C extends Change> List<C> getChangesByType(Class<C> type)
    • getPropertyChanges

      public List<PropertyChange> getPropertyChanges(String propertyName)
      Selects property changes for given property name
    • hasChanges

      public boolean hasChanges()
    • prettyPrint

      public final String prettyPrint()
      Prints the nicely formatted list of Changes. Alias to toString().
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • changesSummary

      public String changesSummary()
    • countByType

      public Map<Class<? extends Change>,Integer> countByType()