io.nflow.engine.model.ModelObject Maven / Gradle / Ivy
package io.nflow.engine.model;
import static org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals;
import static org.apache.commons.lang3.builder.HashCodeBuilder.reflectionHashCode;
import static org.apache.commons.lang3.builder.ToStringBuilder.reflectionToString;
import static org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE;
/**
* Inheriting ModelObject is an implementation detail only to provide toString/equals/hashCode for subclasses. We would use
* something more sensible method, but this is what Java allows. User code should never use ModelObject for anything.
*/
public abstract class ModelObject {
@Override
public String toString() {
return reflectionToString(this, SHORT_PREFIX_STYLE);
}
@Override
public boolean equals(Object obj) {
return reflectionEquals(this, obj);
}
@Override
public int hashCode() {
return reflectionHashCode(this);
}
}