com.github.elibracha.model.Change Maven / Gradle / Ivy
package com.github.elibracha.model;
import lombok.Getter;
@Getter
public class Change {
private final T oldValue;
private final T newValue;
private final Type type;
private Change(T oldValue, T newValue, Type type) {
this.oldValue = oldValue;
this.newValue = newValue;
this.type = type;
}
public static Change changed(T oldValue, T newValue) {
return new Change<>(oldValue, newValue, Type.CHANGED);
}
public static Change added(T newValue) {
return new Change<>(null, newValue, Type.ADDED);
}
public static Change removed(T oldValue) {
return new Change<>(oldValue, null, Type.REMOVED);
}
public enum Type {
ADDED,
CHANGED,
REMOVED
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy