org.javers.core.diff.Change Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javers-core Show documentation
Show all versions of javers-core Show documentation
JaVers - object auditing and diff framework for Java
package org.javers.core.diff;
import java.util.Optional;
import org.javers.core.Javers;
import org.javers.core.commit.CommitMetadata;
import org.javers.core.diff.changetype.NewObject;
import org.javers.core.diff.changetype.ReferenceChange;
import org.javers.core.diff.changetype.ValueChange;
import org.javers.core.diff.changetype.container.ListChange;
import org.javers.core.metamodel.object.GlobalId;
import org.javers.core.metamodel.object.InstanceId;
import java.io.Serializable;
import java.util.Objects;
import static org.javers.common.string.ToStringBuilder.addFirstField;
import static org.javers.common.validation.Validate.*;
/**
* Change represents an atomic difference between two objects.
*
*
* There are several types fo change:
* {@link ValueChange}, {@link ReferenceChange}, {@link ListChange}, {@link NewObject}, and so on.
* See the inheritance hierarchy for the complete list.
*
*
* @see Diff
* @author bartosz walacik
*/
public abstract class Change implements Serializable {
private CommitMetadata commitMetadata; //optional, can't use Optional here, because it isn't Serializable
private final GlobalId affectedCdoId;
private transient Object affectedCdo; //optional
protected Change(GlobalId affectedCdoId) {
this(affectedCdoId, Optional.empty());
}
protected Change(GlobalId affectedCdoId, Optional