org.holmes.evaluator.AbstractEvaluator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of holmes-validation Show documentation
Show all versions of holmes-validation Show documentation
Holmes is a library that provides a simple and fluent API for writing business rules validations on Java projects.
The newest version!
package org.holmes.evaluator;
import org.holmes.Evaluator;
import org.holmes.Joint;
/**
* A convenience implementation for {@link Evaluator} subclasses.
*
* @author diegossilveira
*
* @param
* the type evaluated by this Evaluator.
*/
abstract class AbstractEvaluator implements Evaluator {
private final T target;
private Joint joint;
private Evaluation evaluation;
AbstractEvaluator(T target) {
this.target = target;
}
Joint getJoint() {
return joint;
}
@Override
public void setJoint(Joint joint) {
this.joint = joint;
}
AbstractEvaluator setEvaluation(Evaluation evaluation) {
this.evaluation = evaluation;
return this;
}
@Override
public boolean evaluate() {
try {
return evaluation.evaluate(target);
} catch (NullPointerException e) {
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy