org.holmes.statement.OrStatement 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.statement;
import org.holmes.Statement;
/**
* A disjunctive {@link Statement}. The evaluation is short-circuited; i.e., if
* the first statement is evaluated as true
, the second statement is never
* evaluated.
*
* @author diegossilveira
*/
public class OrStatement implements Statement {
private final Statement firstStatement;
private final Statement secondStatement;
public OrStatement(Statement firstStatement, Statement secondStatement) {
this.firstStatement = firstStatement;
this.secondStatement = secondStatement;
}
@Override
public boolean evaluate() {
return firstStatement.evaluate() || secondStatement.evaluate();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy