org.javers.core.diff.changetype.container.Container 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.changetype.container;
import org.javers.core.diff.changetype.Atomic;
import java.util.Objects;
/**
* internal wrapper for Collection or Array
*/
class Container {
private final T value;
Container(T value) {
this.value = value;
}
public T unwrap() {
return value;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Container)) {
return false;
}
Container other = (Container)obj;
return Objects.equals(value, other.value);
}
@Override
public int hashCode() {
if (value == null) {
return 0;
}
return value.hashCode();
}
}