diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/Grammar.java b/querydsl-core/src/main/java/com/mysema/query/grammar/Grammar.java index f7f18f739..906cf3fa8 100644 --- a/querydsl-core/src/main/java/com/mysema/query/grammar/Grammar.java +++ b/querydsl-core/src/main/java/com/mysema/query/grammar/Grammar.java @@ -39,7 +39,7 @@ public class Grammar { } public static Expr.Boolean in(A left, CollectionType right){ - return createBoolean(Op.IN, createConstant(left), (Expr)right); + return createBoolean(Ops.IN, createConstant(left), (Expr)right); } public static > Expr.Comparable mult(Expr left, A right) { diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/Ops.java b/querydsl-core/src/main/java/com/mysema/query/grammar/Ops.java index 7477e1fa4..f21dc501a 100644 --- a/querydsl-core/src/main/java/com/mysema/query/grammar/Ops.java +++ b/querydsl-core/src/main/java/com/mysema/query/grammar/Ops.java @@ -13,55 +13,51 @@ package com.mysema.query.grammar; */ public interface Ops { - /** - * Operators (the return type is encoded in the 1st generic parameter) - */ - public interface Op { - Op EQ = new OpImpl(); - Op IN = new OpImpl(); - Op ISNOTNULL = new OpImpl(); - Op ISNULL = new OpImpl(); - Op ISTYPEOF = new OpImpl(); - Op NE = new OpImpl(); - Op NOTIN = new OpImpl(); - } + public static class Op{} - public static final class OpImpl implements Op{} + // general + Op EQ = new Op(); + Op IN = new Op(); + Op ISNOTNULL = new Op(); + Op ISNULL = new Op(); + Op ISTYPEOF = new Op(); + Op NE = new Op(); + Op NOTIN = new Op(); // Boolean - Op AND = new OpImpl(); - Op NOT = new OpImpl(); - Op OR = new OpImpl(); - Op XNOR = new OpImpl(); - Op XOR = new OpImpl(); + Op AND = new Op(); + Op NOT = new Op(); + Op OR = new Op(); + Op XNOR = new Op(); + Op XOR = new Op(); // Comparable - Op BETWEEN = new OpImpl(); - Op GOE = new OpImpl(); - Op GT = new OpImpl(); - Op LOE = new OpImpl(); - Op LT = new OpImpl(); - Op NOTBETWEEN = new OpImpl(); + Op BETWEEN = new Op(); + Op GOE = new Op(); + Op GT = new Op(); + Op LOE = new Op(); + Op LT = new Op(); + Op NOTBETWEEN = new Op(); // Date - Op AFTER = new OpImpl(); - Op BEFORE = new OpImpl(); + Op AFTER = new Op(); + Op BEFORE = new Op(); // Number - Op ADD = new OpImpl(); - Op DIV = new OpImpl(); - Op MOD = new OpImpl(); - Op MULT = new OpImpl(); - Op SQRT = new OpImpl(); - Op SUB = new OpImpl(); + Op ADD = new Op(); + Op DIV = new Op(); + Op MOD = new Op(); + Op MULT = new Op(); + Op SQRT = new Op(); + Op SUB = new Op(); // String - Op CONCAT = new OpImpl(); - Op LIKE = new OpImpl(); - Op LOWER = new OpImpl(); - Op SUBSTR1ARG = new OpImpl(); - Op SUBSTR2ARGS = new OpImpl(); - Op TRIM = new OpImpl(); - Op UPPER = new OpImpl(); + Op CONCAT = new Op(); + Op LIKE = new Op(); + Op LOWER = new Op(); + Op SUBSTR1ARG = new Op(); + Op SUBSTR2ARGS = new Op(); + Op TRIM = new Op(); + Op UPPER = new Op(); } diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/types/IntGrammar.java b/querydsl-core/src/main/java/com/mysema/query/grammar/types/IntGrammar.java index 3f129508f..b39a077b4 100644 --- a/querydsl-core/src/main/java/com/mysema/query/grammar/types/IntGrammar.java +++ b/querydsl-core/src/main/java/com/mysema/query/grammar/types/IntGrammar.java @@ -13,7 +13,6 @@ import static com.mysema.query.grammar.types.Factory.createString; import com.mysema.query.grammar.Ops; import com.mysema.query.grammar.Order; import com.mysema.query.grammar.OrderSpecifier; -import com.mysema.query.grammar.Ops.Op; import com.mysema.query.grammar.types.Expr.CollectionType; /** @@ -124,11 +123,11 @@ class IntGrammar{ } static Expr.Boolean eq(Expr left, A right) { - return createBoolean(Op.EQ, left, createConstant(right)); + return createBoolean(Ops.EQ, left, createConstant(right)); } static Expr.Boolean eq(Expr left, Expr right) { - return createBoolean(Op.EQ, left, right); + return createBoolean(Ops.EQ, left, right); } static > Expr.Boolean goe(Expr left, @@ -152,21 +151,21 @@ class IntGrammar{ static > Expr.Boolean in(Expr left, A... rest) { - return createBoolean(Op.IN, left, createConstant(rest)); + return createBoolean(Ops.IN, left, createConstant(rest)); } static Expr.Boolean in(Expr left, CollectionType right){ - return createBoolean(Op.IN, left, (Expr)right); + return createBoolean(Ops.IN, left, (Expr)right); } static Expr.Boolean isnotnull(Expr left) { - return createBoolean(Op.ISNOTNULL, left); + return createBoolean(Ops.ISNOTNULL, left); } static Expr.Boolean isnull(Expr left) { - return createBoolean(Op.ISNULL, left); + return createBoolean(Ops.ISNULL, left); } static Expr.Boolean like(Expr left, String right) { @@ -197,11 +196,11 @@ class IntGrammar{ } static Expr.Boolean ne(Expr left, A right) { - return createBoolean(Op.NE, left, createConstant(right)); + return createBoolean(Ops.NE, left, createConstant(right)); } static Expr.Boolean ne(Expr left, Expr right) { - return createBoolean(Op.NE, left, right); + return createBoolean(Ops.NE, left, right); } static > Expr.Boolean notBetween(Expr left, @@ -216,11 +215,11 @@ class IntGrammar{ static > Expr.Boolean notIn(Expr left, A... rest) { - return createBoolean(Op.NOTIN, left, createConstant(rest)); + return createBoolean(Ops.NOTIN, left, createConstant(rest)); } static Expr.Boolean notIn(Expr left, CollectionType right){ - return createBoolean(Op.NOTIN, left, (Expr)right); + return createBoolean(Ops.NOTIN, left, (Expr)right); } static Expr.Boolean or(Expr.Boolean left, Expr.Boolean right) { @@ -240,7 +239,7 @@ class IntGrammar{ } static Expr.Boolean typeOf(Expr left, Class right) { - return createBoolean(Op.ISTYPEOF, left, createConstant(right)); + return createBoolean(Ops.ISTYPEOF, left, createConstant(right)); } static Expr.String upper(Expr left) { diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/types/PathMetadata.java b/querydsl-core/src/main/java/com/mysema/query/grammar/types/PathMetadata.java index ed2941fc6..45a1ea4df 100644 --- a/querydsl-core/src/main/java/com/mysema/query/grammar/types/PathMetadata.java +++ b/querydsl-core/src/main/java/com/mysema/query/grammar/types/PathMetadata.java @@ -30,36 +30,36 @@ public final class PathMetadata { public static PathMetadata forListAccess(Path.Collection parent, Expr index) { - return new PathMetadata(parent, index, PathType.LISTVALUE); + return new PathMetadata(parent, index, LISTVALUE); } public static PathMetadata forListAccess(Path.Collection parent, int index) { return new PathMetadata(parent, Factory.createConstant(index), - PathType.LISTVALUE_CONSTANT); + LISTVALUE_CONSTANT); } public static PathMetadata forSize(Path.Collection parent) { - return new PathMetadata(parent, null, PathType.SIZE); + return new PathMetadata(parent, null, SIZE); } public static PathMetadata forMapAccess(Path.Map parent, Expr key) { - return new PathMetadata(parent, key, PathType.MAPVALUE); + return new PathMetadata(parent, key, MAPVALUE); } public static PathMetadata forMapAccess(Path.Map parent, KT key) { - return new PathMetadata(parent, Factory.createConstant(key), PathType.MAPVALUE_CONSTANT); + return new PathMetadata(parent, Factory.createConstant(key), MAPVALUE_CONSTANT); } public static PathMetadata forProperty(Path parent, String property) { - return new PathMetadata(parent, Factory.createConstant(property), PathType.PROPERTY); + return new PathMetadata(parent, Factory.createConstant(property), PROPERTY); } public static PathMetadata forVariable(String variable) { - return new PathMetadata(null, Factory.createConstant(variable), PathType.VARIABLE); + return new PathMetadata(null, Factory.createConstant(variable), VARIABLE); } public Expr getExpression() { @@ -74,20 +74,18 @@ public final class PathMetadata { return pathType; } - public static final class PathTypeImpl implements PathType{ } - /** * Type provides * */ - public interface PathType extends Ops.Op> { - PathType LISTVALUE = new PathTypeImpl(); - PathType LISTVALUE_CONSTANT = new PathTypeImpl(); - PathType MAPVALUE = new PathTypeImpl(); - PathType MAPVALUE_CONSTANT = new PathTypeImpl(); - PathType PROPERTY = new PathTypeImpl(); - PathType VARIABLE = new PathTypeImpl(); - PathType SIZE = new PathTypeImpl(); - } + public static class PathType extends Ops.Op> {} + + public static PathType LISTVALUE = new PathType(); + public static PathType LISTVALUE_CONSTANT = new PathType(); + public static PathType MAPVALUE = new PathType(); + public static PathType MAPVALUE_CONSTANT = new PathType(); + public static PathType PROPERTY = new PathType(); + public static PathType VARIABLE = new PathType(); + public static PathType SIZE = new PathType(); }