/* * Copyright (c) 2009-2014, Architector Inc., Japan * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.iciql; public abstract class NestedConditions { public static class And extends NestedConditions { public And(Db db, T alias) { super(db, alias); } protected QueryCondition and(boolean x) { return where.and(x); } protected QueryCondition and(byte x) { return where.and(x); } protected QueryCondition and(short x) { return where.and(x); } protected QueryCondition and(int x) { return where.and(x); } protected QueryCondition and(long x) { return where.and(x); } protected QueryCondition and(float x) { return where.and(x); } protected QueryCondition and(double x) { return where.and(x); } protected QueryCondition and(A x) { return where.and(x); } protected QueryWhere and(And conditions) { where.andOpen(); where.query.addConditionToken(conditions.where.query); return where.close(); } protected QueryWhere and(Or conditions) { where.andOpen(); where.query.addConditionToken(conditions.where.query); return where.close(); } } public static class Or extends NestedConditions { public Or(Db db, T alias) { super(db, alias); } protected QueryCondition or(boolean x) { return where.or(x); } protected QueryCondition or(byte x) { return where.or(x); } protected QueryCondition or(short x) { return where.or(x); } protected QueryCondition or(int x) { return where.or(x); } protected QueryCondition or(long x) { return where.or(x); } protected QueryCondition or(float x) { return where.or(x); } protected QueryCondition or(double x) { return where.or(x); } protected QueryCondition or(A x) { return where.or(x); } protected QueryWhere or(And conditions) { where.orOpen(); where.query.addConditionToken(conditions.where.query); return where.close(); } protected QueryWhere or(Or conditions) { where.orOpen(); where.query.addConditionToken(conditions.where.query); return where.close(); } } QueryWhere where; private NestedConditions(Db db, T alias) { where = new QueryWhere(Query.rebuild(db, alias)); } }