org.holmes.evaluator.BooleanEvaluator 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;
/**
* An {@link Evaluator} for the {@link Boolean} type.
*
* @author diegossilveira
*/
public class BooleanEvaluator extends ObjectEvaluator {
public BooleanEvaluator(Boolean target) {
super(target);
}
/**
* Ensures that the {@link Boolean} target is not null and it's logical value is TRUE.
*
* @return an instance of {@link Joint} class
*/
public Joint isTrue() {
return setEvaluation(new Evaluation() {
public boolean evaluate(Boolean target) {
return target != null && target;
}
}).getJoint();
}
/**
* Ensures that the {@link Boolean} target is not null and it's logical value is FALSE.
*
* @return an instance of {@link Joint} class
*/
public Joint isFalse() {
return setEvaluation(new Evaluation() {
public boolean evaluate(Boolean target) {
return target != null && !target;
}
}).getJoint();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy