org.influxdb.querybuilder.WhereNested Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of influxdb-java Show documentation
Show all versions of influxdb-java Show documentation
Java API to access the InfluxDB REST API
package org.influxdb.querybuilder;
import java.util.ArrayList;
import java.util.List;
import org.influxdb.querybuilder.clauses.AndConjunction;
import org.influxdb.querybuilder.clauses.Clause;
import org.influxdb.querybuilder.clauses.ConjunctionClause;
import org.influxdb.querybuilder.clauses.NestedClause;
import org.influxdb.querybuilder.clauses.OrConjunction;
public class WhereNested {
private final List clauses = new ArrayList<>();
private final boolean orConjunction;
private final T where;
WhereNested(final T where, final boolean orConjunction) {
this.where = where;
this.orConjunction = orConjunction;
}
public WhereNested and(final Clause clause) {
clauses.add(new AndConjunction(clause));
return this;
}
public WhereNested or(final Clause clause) {
clauses.add(new OrConjunction(clause));
return this;
}
public T close() {
if (orConjunction) {
where.or(new NestedClause(clauses));
} else {
where.and(new NestedClause(clauses));
}
return where;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy