From bb87e621eefd97872aa1a619d38c166b2f07db84 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 5 Apr 2016 12:27:55 -0400 Subject: Reformat project with default IntelliJ settings --- src/main/java/com/iciql/QueryCondition.java | 238 ++++++++++++++-------------- 1 file changed, 118 insertions(+), 120 deletions(-) (limited to 'src/main/java/com/iciql/QueryCondition.java') diff --git a/src/main/java/com/iciql/QueryCondition.java b/src/main/java/com/iciql/QueryCondition.java index cef95c1..fce66af 100644 --- a/src/main/java/com/iciql/QueryCondition.java +++ b/src/main/java/com/iciql/QueryCondition.java @@ -21,128 +21,126 @@ import com.iciql.util.Utils; /** * This class represents a query with an incomplete condition. - * - * @param - * the return type of the query - * @param - * the incomplete condition data type + * + * @param the return type of the query + * @param the incomplete condition data type */ public class QueryCondition { - private Query query; - private A x; - - QueryCondition(Query query, A x) { - this.query = query; - this.x = x; - } - - public QueryWhere in(SubQuery q) { - query.addConditionToken(new SubQueryCondition(x, q)); - return new QueryWhere(query); - } - - public QueryWhere oneOf(A... a) { - return oneOf(Utils.newArrayIterable(a)); - } - - public QueryWhere oneOf(Iterable i) { - query.addConditionToken(new Condition(x, i, CompareType.IN)); - return new QueryWhere(query); - } - - public QueryWhere noneOf(A... a) { - return noneOf(Utils.newArrayIterable(a)); - } - - public QueryWhere noneOf(Iterable i) { - query.addConditionToken(new Condition(x, i, CompareType.NOT_IN)); - return new QueryWhere(query); - } - - public QueryWhere is(A y) { - query.addConditionToken(new Condition(x, y, CompareType.EQUAL)); - return new QueryWhere(query); - } - - public QueryWhere isNot(A y) { - query.addConditionToken(new Condition(x, y, CompareType.NOT_EQUAL)); - return new QueryWhere(query); - } - - public QueryWhere isNull() { - query.addConditionToken(new Condition(x, CompareType.IS_NULL)); - return new QueryWhere(query); - } - - public QueryWhere isNotNull() { - query.addConditionToken(new Condition(x, CompareType.IS_NOT_NULL)); - return new QueryWhere(query); - } - - public QueryWhere exceeds(A y) { - query.addConditionToken(new Condition(x, y, CompareType.EXCEEDS)); - return new QueryWhere(query); - } - - public QueryWhere atLeast(A y) { - query.addConditionToken(new Condition(x, y, CompareType.AT_LEAST)); - return new QueryWhere(query); - } - - public QueryWhere lessThan(A y) { - query.addConditionToken(new Condition(x, y, CompareType.LESS_THAN)); - return new QueryWhere(query); - } - - public QueryWhere atMost(A y) { - query.addConditionToken(new Condition(x, y, CompareType.AT_MOST)); - return new QueryWhere(query); - } - - public QueryBetween between(A y) { - return new QueryBetween(query, x, y); - } - - public QueryWhere like(A pattern) { - query.addConditionToken(new Condition(x, pattern, CompareType.LIKE)); - return new QueryWhere(query); - } - - /* - * These method allows you to generate "x=?", "x!=?", etc where conditions. - * Parameter substitution must be done manually later with db.executeQuery. - * This allows for building re-usable SQL string statements from your model - * classes. - */ - public QueryWhere isParameter() { - query.addConditionToken(new RuntimeParameter(x, CompareType.EQUAL)); - return new QueryWhere(query); - } - - public QueryWhere isNotParameter() { - query.addConditionToken(new RuntimeParameter(x, CompareType.NOT_EQUAL)); - return new QueryWhere(query); - } - - public QueryWhere exceedsParameter() { - query.addConditionToken(new RuntimeParameter(x, CompareType.EXCEEDS)); - return new QueryWhere(query); - } - - public QueryWhere lessThanParameter() { - query.addConditionToken(new RuntimeParameter(x, CompareType.LESS_THAN)); - return new QueryWhere(query); - } - - public QueryWhere atMostParameter() { - query.addConditionToken(new RuntimeParameter(x, CompareType.AT_MOST)); - return new QueryWhere(query); - } - - public QueryWhere likeParameter() { - query.addConditionToken(new RuntimeParameter(x, CompareType.LIKE)); - return new QueryWhere(query); - } + private Query query; + private A x; + + QueryCondition(Query query, A x) { + this.query = query; + this.x = x; + } + + public QueryWhere in(SubQuery q) { + query.addConditionToken(new SubQueryCondition(x, q)); + return new QueryWhere(query); + } + + public QueryWhere oneOf(A... a) { + return oneOf(Utils.newArrayIterable(a)); + } + + public QueryWhere oneOf(Iterable i) { + query.addConditionToken(new Condition(x, i, CompareType.IN)); + return new QueryWhere(query); + } + + public QueryWhere noneOf(A... a) { + return noneOf(Utils.newArrayIterable(a)); + } + + public QueryWhere noneOf(Iterable i) { + query.addConditionToken(new Condition(x, i, CompareType.NOT_IN)); + return new QueryWhere(query); + } + + public QueryWhere is(A y) { + query.addConditionToken(new Condition(x, y, CompareType.EQUAL)); + return new QueryWhere(query); + } + + public QueryWhere isNot(A y) { + query.addConditionToken(new Condition(x, y, CompareType.NOT_EQUAL)); + return new QueryWhere(query); + } + + public QueryWhere isNull() { + query.addConditionToken(new Condition(x, CompareType.IS_NULL)); + return new QueryWhere(query); + } + + public QueryWhere isNotNull() { + query.addConditionToken(new Condition(x, CompareType.IS_NOT_NULL)); + return new QueryWhere(query); + } + + public QueryWhere exceeds(A y) { + query.addConditionToken(new Condition(x, y, CompareType.EXCEEDS)); + return new QueryWhere(query); + } + + public QueryWhere atLeast(A y) { + query.addConditionToken(new Condition(x, y, CompareType.AT_LEAST)); + return new QueryWhere(query); + } + + public QueryWhere lessThan(A y) { + query.addConditionToken(new Condition(x, y, CompareType.LESS_THAN)); + return new QueryWhere(query); + } + + public QueryWhere atMost(A y) { + query.addConditionToken(new Condition(x, y, CompareType.AT_MOST)); + return new QueryWhere(query); + } + + public QueryBetween between(A y) { + return new QueryBetween(query, x, y); + } + + public QueryWhere like(A pattern) { + query.addConditionToken(new Condition(x, pattern, CompareType.LIKE)); + return new QueryWhere(query); + } + + /* + * These method allows you to generate "x=?", "x!=?", etc where conditions. + * Parameter substitution must be done manually later with db.executeQuery. + * This allows for building re-usable SQL string statements from your model + * classes. + */ + public QueryWhere isParameter() { + query.addConditionToken(new RuntimeParameter(x, CompareType.EQUAL)); + return new QueryWhere(query); + } + + public QueryWhere isNotParameter() { + query.addConditionToken(new RuntimeParameter(x, CompareType.NOT_EQUAL)); + return new QueryWhere(query); + } + + public QueryWhere exceedsParameter() { + query.addConditionToken(new RuntimeParameter(x, CompareType.EXCEEDS)); + return new QueryWhere(query); + } + + public QueryWhere lessThanParameter() { + query.addConditionToken(new RuntimeParameter(x, CompareType.LESS_THAN)); + return new QueryWhere(query); + } + + public QueryWhere atMostParameter() { + query.addConditionToken(new RuntimeParameter(x, CompareType.AT_MOST)); + return new QueryWhere(query); + } + + public QueryWhere likeParameter() { + query.addConditionToken(new RuntimeParameter(x, CompareType.LIKE)); + return new QueryWhere(query); + } } -- cgit v1.2.3