diff options
Diffstat (limited to 'src/main/java/com/iciql/TestCondition.java')
-rw-r--r-- | src/main/java/com/iciql/TestCondition.java | 157 |
1 files changed, 78 insertions, 79 deletions
diff --git a/src/main/java/com/iciql/TestCondition.java b/src/main/java/com/iciql/TestCondition.java index 010f5a1..3c08eec 100644 --- a/src/main/java/com/iciql/TestCondition.java +++ b/src/main/java/com/iciql/TestCondition.java @@ -21,95 +21,94 @@ import com.iciql.util.Utils; /**
* This class represents an incomplete condition.
- *
- * @param <A>
- * the incomplete condition data type
+ *
+ * @param <A> the incomplete condition data type
*/
public class TestCondition<A> {
- private A x;
+ private A x;
- public TestCondition(A x) {
- this.x = x;
- }
+ public TestCondition(A x) {
+ this.x = x;
+ }
- public Boolean is(A y) {
- Boolean o = Utils.newObject(Boolean.class);
- return Db.registerToken(o, new Function("=", x, y) {
- public <T> void appendSQL(SQLStatement stat, Query<T> query) {
- stat.appendSQL("(");
- query.appendSQL(stat, null, x[0]);
- stat.appendSQL(" = ");
- query.appendSQL(stat, x[0], x[1]);
- stat.appendSQL(")");
- }
- });
- }
+ public Boolean is(A y) {
+ Boolean o = Utils.newObject(Boolean.class);
+ return Db.registerToken(o, new Function("=", x, y) {
+ public <T> void appendSQL(SQLStatement stat, Query<T> query) {
+ stat.appendSQL("(");
+ query.appendSQL(stat, null, x[0]);
+ stat.appendSQL(" = ");
+ query.appendSQL(stat, x[0], x[1]);
+ stat.appendSQL(")");
+ }
+ });
+ }
- public Boolean exceeds(A y) {
- Boolean o = Utils.newObject(Boolean.class);
- return Db.registerToken(o, new Function(">", x, y) {
- public <T> void appendSQL(SQLStatement stat, Query<T> query) {
- stat.appendSQL("(");
- query.appendSQL(stat, null, x[0]);
- stat.appendSQL(" > ");
- query.appendSQL(stat, x[0], x[1]);
- stat.appendSQL(")");
- }
- });
- }
+ public Boolean exceeds(A y) {
+ Boolean o = Utils.newObject(Boolean.class);
+ return Db.registerToken(o, new Function(">", x, y) {
+ public <T> void appendSQL(SQLStatement stat, Query<T> query) {
+ stat.appendSQL("(");
+ query.appendSQL(stat, null, x[0]);
+ stat.appendSQL(" > ");
+ query.appendSQL(stat, x[0], x[1]);
+ stat.appendSQL(")");
+ }
+ });
+ }
- public Boolean atLeast(A y) {
- Boolean o = Utils.newObject(Boolean.class);
- return Db.registerToken(o, new Function(">=", x, y) {
- public <T> void appendSQL(SQLStatement stat, Query<T> query) {
- stat.appendSQL("(");
- query.appendSQL(stat, null, x[0]);
- stat.appendSQL(" >= ");
- query.appendSQL(stat, x[0], x[1]);
- stat.appendSQL(")");
- }
- });
- }
+ public Boolean atLeast(A y) {
+ Boolean o = Utils.newObject(Boolean.class);
+ return Db.registerToken(o, new Function(">=", x, y) {
+ public <T> void appendSQL(SQLStatement stat, Query<T> query) {
+ stat.appendSQL("(");
+ query.appendSQL(stat, null, x[0]);
+ stat.appendSQL(" >= ");
+ query.appendSQL(stat, x[0], x[1]);
+ stat.appendSQL(")");
+ }
+ });
+ }
- public Boolean lessThan(A y) {
- Boolean o = Utils.newObject(Boolean.class);
- return Db.registerToken(o, new Function("<", x, y) {
- public <T> void appendSQL(SQLStatement stat, Query<T> query) {
- stat.appendSQL("(");
- query.appendSQL(stat, null, x[0]);
- stat.appendSQL(" < ");
- query.appendSQL(stat, x[0], x[1]);
- stat.appendSQL(")");
- }
- });
- }
+ public Boolean lessThan(A y) {
+ Boolean o = Utils.newObject(Boolean.class);
+ return Db.registerToken(o, new Function("<", x, y) {
+ public <T> void appendSQL(SQLStatement stat, Query<T> query) {
+ stat.appendSQL("(");
+ query.appendSQL(stat, null, x[0]);
+ stat.appendSQL(" < ");
+ query.appendSQL(stat, x[0], x[1]);
+ stat.appendSQL(")");
+ }
+ });
+ }
- public Boolean atMost(A y) {
- Boolean o = Utils.newObject(Boolean.class);
- return Db.registerToken(o, new Function("<=", x, y) {
- public <T> void appendSQL(SQLStatement stat, Query<T> query) {
- stat.appendSQL("(");
- query.appendSQL(stat, null, x[0]);
- stat.appendSQL(" <= ");
- query.appendSQL(stat, x[0], x[1]);
- stat.appendSQL(")");
- }
- });
- }
+ public Boolean atMost(A y) {
+ Boolean o = Utils.newObject(Boolean.class);
+ return Db.registerToken(o, new Function("<=", x, y) {
+ public <T> void appendSQL(SQLStatement stat, Query<T> query) {
+ stat.appendSQL("(");
+ query.appendSQL(stat, null, x[0]);
+ stat.appendSQL(" <= ");
+ query.appendSQL(stat, x[0], x[1]);
+ stat.appendSQL(")");
+ }
+ });
+ }
- public Boolean like(A pattern) {
- Boolean o = Utils.newObject(Boolean.class);
- return Db.registerToken(o, new Function("LIKE", x, pattern) {
- public <T> void appendSQL(SQLStatement stat, Query<T> query) {
- stat.appendSQL("(");
- query.appendSQL(stat, null, x[0]);
- stat.appendSQL(" LIKE ");
- query.appendSQL(stat, x[0], x[1]);
- stat.appendSQL(")");
- }
- });
- }
+ public Boolean like(A pattern) {
+ Boolean o = Utils.newObject(Boolean.class);
+ return Db.registerToken(o, new Function("LIKE", x, pattern) {
+ public <T> void appendSQL(SQLStatement stat, Query<T> query) {
+ stat.appendSQL("(");
+ query.appendSQL(stat, null, x[0]);
+ stat.appendSQL(" LIKE ");
+ query.appendSQL(stat, x[0], x[1]);
+ stat.appendSQL(")");
+ }
+ });
+ }
}
|