diff --git a/querydsl-hql/pom.xml b/querydsl-hql/pom.xml
index aec6c5db8..9bbb84dc8 100644
--- a/querydsl-hql/pom.xml
+++ b/querydsl-hql/pom.xml
@@ -7,7 +7,7 @@
com.mysema.querydsl
querydsl-root
- 0.2.3
+ 0.2.4
com.mysema.querydsl
diff --git a/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlGrammar.java b/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlGrammar.java
index 76d6d9904..173f93016 100644
--- a/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlGrammar.java
+++ b/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlGrammar.java
@@ -5,6 +5,10 @@
*/
package com.mysema.query.grammar;
+import static com.mysema.query.grammar.types.Factory.createBoolean;
+import static com.mysema.query.grammar.types.Factory.createComparable;
+import static com.mysema.query.grammar.types.Factory.createNumber;
+
import java.util.Collection;
import java.util.Date;
@@ -15,7 +19,9 @@ import com.mysema.query.grammar.HqlOps.OpHql;
import com.mysema.query.grammar.HqlOps.OpNumberAgg;
import com.mysema.query.grammar.HqlOps.OpQuant;
import com.mysema.query.grammar.Ops.Op;
-import com.mysema.query.grammar.Types.*;
+import com.mysema.query.grammar.types.Expr;
+import com.mysema.query.grammar.types.Path;
+import com.mysema.query.grammar.types.PathMetadata;
/**
* HqlGrammar extends the Query DSL base grammar to provide HQL specific syntax elements
@@ -25,169 +31,169 @@ import com.mysema.query.grammar.Types.*;
*/
public class HqlGrammar extends Grammar{
- public static Expr all(CollectionType col){
+ public static Expr all(Expr.CollectionType col){
return new ExprQuantSimple(OpQuant.ALL, col);
}
- public static > ExprComparable all(CollectionType col){
+ public static > Expr.Comparable all(Expr.CollectionType col){
return new ExprQuantComparable(OpQuant.ALL, col);
}
- public static Expr any(CollectionType col){
+ public static Expr any(Expr.CollectionType col){
return new ExprQuantSimple(OpQuant.ANY, col);
}
- public static > ExprComparable any(CollectionType col){
+ public static > Expr.Comparable any(Expr.CollectionType col){
return new ExprQuantComparable(OpQuant.ANY, col);
}
- public static > ExprComparable avg(Expr left){
- return _number(OpNumberAgg.AVG, left);
+ public static > Expr.Comparable avg(Expr left){
+ return createNumber(OpNumberAgg.AVG, left);
}
- public static > ExprComparable avg(PathCollection left){
+ public static > Expr.Comparable avg(Path.Collection left){
return new ExprQuantComparable(OpQuant.AVG_IN_COL, left);
}
- public static ExprComparable count(){
+ public static Expr.Comparable count(){
return new CountExpr(null);
}
- public static ExprComparable count(Expr> expr){
+ public static Expr.Comparable count(Expr> expr){
return new CountExpr(expr);
}
- public static ExprComparable current_date(){
- return _comparable(OpHql.CURRENT_DATE);
+ public static Expr.Comparable current_date(){
+ return createComparable(OpHql.CURRENT_DATE);
}
- public static ExprComparable current_time(){
- return _comparable(OpHql.CURRENT_TIME);
+ public static Expr.Comparable current_time(){
+ return createComparable(OpHql.CURRENT_TIME);
}
- public static ExprComparable current_timestamp(){
- return _comparable(OpHql.CURRENT_TIMESTAMP);
+ public static Expr.Comparable current_timestamp(){
+ return createComparable(OpHql.CURRENT_TIMESTAMP);
}
- public static ExprComparable day(Expr date){
- return _comparable(OpHql.DAY, date);
+ public static Expr.Comparable day(Expr date){
+ return createComparable(OpHql.DAY, date);
}
- public static Expr distinct(PathEntity left){
+ public static Expr distinct(Path.Entity left){
return new DistinctPath(left);
}
- public static Expr distinct(PathNoEntity left){
+ public static Expr distinct(Path.NoEntity left){
return new DistinctPath(left);
}
- public static ExprBoolean exists(CollectionType col){
+ public static Expr.Boolean exists(Expr.CollectionType col){
return new ExprQuantBoolean(OpQuant.EXISTS, col);
}
- public static SubQuery from(ExprEntity select){
+ public static SubQuery from(Expr.Entity select){
return new SubQuery(select).from(select);
}
- public static ExprComparable hour(Expr date){
- return _comparable(OpHql.HOUR, date);
+ public static Expr.Comparable hour(Expr date){
+ return createComparable(OpHql.HOUR, date);
}
- public static PathComponentCollection indices(PathCollection> col){
- return new PathComponentCollection(Integer.class, new PathMetadata>(col, null, HqlPathType.LISTINDICES));
+ public static Path.ComponentCollection indices(Path.Collection> col){
+ return new Path.ComponentCollection(Integer.class, new PathMetadata>(col, null, HqlPathType.LISTINDICES));
}
- public static PathComponentCollection indices(PathMap col){
- return new PathComponentCollection(col.getKeyType(), new PathMetadata>(col, null, HqlPathType.LISTINDICES));
+ public static Path.ComponentCollection indices(Path.Map col){
+ return new Path.ComponentCollection(col.getKeyType(), new PathMetadata>(col, null, HqlPathType.LISTINDICES));
}
- public static ExprBoolean isempty(PathComponentCollection> collection) {
- return _boolean(OpHql.ISEMPTY, collection);
+ public static Expr.Boolean isempty(Path.ComponentCollection> collection) {
+ return createBoolean(OpHql.ISEMPTY, collection);
}
- public static ExprBoolean isempty(PathEntityCollection> collection) {
- return _boolean(OpHql.ISEMPTY, collection);
+ public static Expr.Boolean isempty(Path.EntityCollection> collection) {
+ return createBoolean(OpHql.ISEMPTY, collection);
}
- public static ExprBoolean isnotempty(PathComponentCollection> collection) {
- return _boolean(OpHql.ISNOTEMPTY, collection);
+ public static Expr.Boolean isnotempty(Path.ComponentCollection> collection) {
+ return createBoolean(OpHql.ISNOTEMPTY, collection);
}
- public static ExprBoolean isnotempty(PathEntityCollection> collection) {
- return _boolean(OpHql.ISNOTEMPTY, collection);
+ public static Expr.Boolean isnotempty(Path.EntityCollection> collection) {
+ return createBoolean(OpHql.ISNOTEMPTY, collection);
}
- public static > ExprComparable max(Expr left){
- return _number(OpNumberAgg.MAX, left);
+ public static > Expr.Comparable max(Expr left){
+ return createNumber(OpNumberAgg.MAX, left);
}
- public static > ExprComparable max(PathCollection left){
+ public static > Expr.Comparable max(Path.Collection left){
return new ExprQuantComparable(OpQuant.MAX_IN_COL, left);
}
- public static PathEntity maxelement(PathEntityCollection col) {
- return new PathEntity(col.getElementType(), new PathMetadata(col, null, HqlPathType.MINELEMENT));
+ public static Path.Entity maxelement(Path.EntityCollection col) {
+ return new Path.Entity(col.getElementType(), new PathMetadata(col, null, HqlPathType.MINELEMENT));
}
- public static PathComparable maxindex(PathComponentCollection col) {
- return new PathComparable(Integer.class, new PathMetadata(col, null, HqlPathType.MAXINDEX));
+ public static Path.Comparable maxindex(Path.ComponentCollection col) {
+ return new Path.Comparable(Integer.class, new PathMetadata(col, null, HqlPathType.MAXINDEX));
}
- public static PathComparable maxindex(PathEntityCollection col) {
- return new PathComparable(Integer.class, new PathMetadata(col, null, HqlPathType.MAXINDEX));
+ public static Path.Comparable maxindex(Path.EntityCollection col) {
+ return new Path.Comparable(Integer.class, new PathMetadata(col, null, HqlPathType.MAXINDEX));
}
- public static > ExprComparable min(Expr left){
- return _number(OpNumberAgg.MIN, left);
+ public static > Expr.Comparable min(Expr left){
+ return createNumber(OpNumberAgg.MIN, left);
}
- public static > ExprComparable min(PathCollection left){
+ public static > Expr.Comparable min(Path.Collection left){
return new ExprQuantComparable(OpQuant.MIN_IN_COL, left);
}
- public static PathEntity minelement(PathEntityCollection col) {
- return new PathEntity(col.getElementType(), new PathMetadata(col, null, HqlPathType.MINELEMENT));
+ public static Path.Entity minelement(Path.EntityCollection col) {
+ return new Path.Entity(col.getElementType(), new PathMetadata(col, null, HqlPathType.MINELEMENT));
}
- public static PathComparable minindex(PathComponentCollection col) {
- return new PathComparable(Integer.class, new PathMetadata(col, null, HqlPathType.MININDEX));
+ public static Path.Comparable minindex(Path.ComponentCollection col) {
+ return new Path.Comparable(Integer.class, new PathMetadata(col, null, HqlPathType.MININDEX));
}
- public static PathComparable minindex(PathEntityCollection col) {
- return new PathComparable(Integer.class, new PathMetadata(col, null, HqlPathType.MININDEX));
+ public static Path.Comparable minindex(Path.EntityCollection col) {
+ return new Path.Comparable(Integer.class, new PathMetadata(col, null, HqlPathType.MININDEX));
}
- public static ExprComparable minute(Expr date){
- return _comparable(OpHql.MINUTE, date);
+ public static Expr.Comparable minute(Expr date){
+ return createComparable(OpHql.MINUTE, date);
}
- public static ExprComparable month(Expr date){
- return _comparable(OpHql.MONTH, date);
+ public static Expr.Comparable month(Expr date){
+ return createComparable(OpHql.MONTH, date);
}
public static Expr newInstance(Class a, Expr>... args){
return new Constructor(a,args);
}
- public static ExprBoolean notExists(CollectionType col){
+ public static Expr.Boolean notExists(Expr.CollectionType col){
return new ExprQuantBoolean(OpQuant.NOTEXISTS, col);
}
- public static ExprComparable second(Expr date){
- return _comparable(OpHql.SECOND, date);
+ public static Expr.Comparable second(Expr date){
+ return createComparable(OpHql.SECOND, date);
}
public static SubQuery select(Expr select){
return new SubQuery(select);
}
- public static Expr some(CollectionType col){
+ public static Expr some(Expr.CollectionType col){
return any(col);
}
- public static > ExprComparable sum(Expr left){
- return _number(OpHql.SUM, left);
+ public static > Expr.Comparable sum(Expr left){
+ return createNumber(OpHql.SUM, left);
}
- public static ExprComparable sysdate(){
- return _comparable(OpHql.SYSDATE);
+ public static Expr.Comparable sysdate(){
+ return createComparable(OpHql.SYSDATE);
}
- public static ExprComparable year(Expr date){
- return _comparable(OpHql.YEAR, date);
+ public static Expr.Comparable year(Expr date){
+ return createComparable(OpHql.YEAR, date);
}
public static class Constructor extends Expr{
@@ -199,7 +205,7 @@ public class HqlGrammar extends Grammar{
public Expr>[] getArgs(){ return args; }
}
- public static class CountExpr extends ExprComparable{
+ public static class CountExpr extends Expr.Comparable{
private final Expr> target;
CountExpr(Expr> expr) {
super(Long.class);
@@ -223,10 +229,10 @@ public class HqlGrammar extends Grammar{
Expr> getTarget();
}
- public static class ExprQuantBoolean extends ExprBoolean implements ExprQuant{
+ public static class ExprQuantBoolean extends Expr.Boolean implements ExprQuant{
private final Expr> col;
private final Op> op;
- ExprQuantBoolean(Op> op, CollectionType col) {
+ ExprQuantBoolean(Op> op, Expr.CollectionType col) {
this.op = op;
this.col = (Expr>) col;
}
@@ -234,10 +240,10 @@ public class HqlGrammar extends Grammar{
public Expr> getTarget() {return col;}
}
- public static class ExprQuantComparable> extends ExprComparable implements ExprQuant{
+ public static class ExprQuantComparable> extends Expr.Comparable implements ExprQuant{
private final Expr> col;
private final Op> op;
- ExprQuantComparable(Op> op, CollectionType col) {
+ ExprQuantComparable(Op> op, Expr.CollectionType col) {
super(null);
this.op = op;
this.col = (Expr>)col;
@@ -258,25 +264,26 @@ public class HqlGrammar extends Grammar{
public Expr> getTarget() {return col;}
}
- public static class SubQuery extends Expr implements Query>,CollectionType{
+ public static class SubQuery extends Expr implements Query>, Expr.CollectionType{
@SuppressWarnings("unchecked")
private QueryBase> query = new QueryBase();
SubQuery(Expr select) {
super(null);
query.select(select);
}
- public SubQuery from(ExprEntity>... o) {query.from(o); return this;}
- public SubQuery fullJoin(ExprEntity> o) {query.fullJoin(o); return this;}
+ public SubQuery from(Expr.Entity>... o) {query.from(o); return this;}
+ public SubQuery fullJoin(Expr.Entity> o) {query.fullJoin(o); return this;}
public QueryBase> getQuery(){ return query;}
public SubQuery groupBy(Expr>... o) {query.groupBy(o); return this;}
- public SubQuery having(ExprBoolean... o) {query.having(o); return this;}
- public SubQuery innerJoin(ExprEntity> o) {query.innerJoin(o); return this;}
- public SubQuery join(ExprEntity> o) {query.join(o); return this;}
- public SubQuery leftJoin(ExprEntity> o) {query.leftJoin(o); return this;}
+ public SubQuery having(Expr.Boolean... o) {query.having(o); return this;}
+ public SubQuery innerJoin(Expr.Entity> o) {query.innerJoin(o); return this;}
+ public SubQuery join(Expr.Entity> o) {query.join(o); return this;}
+ public SubQuery leftJoin(Expr.Entity> o) {query.leftJoin(o); return this;}
public SubQuery orderBy(OrderSpecifier>... o) {query.orderBy(o); return this;}
public SubQuery select(Expr>... o) {query.select(o); return this;}
- public SubQuery where(ExprBoolean... o) {query.where(o); return this;}
- public SubQuery with(ExprBoolean... o) {query.with(o); return this;}
+ public SubQuery where(Expr.Boolean... o) {query.where(o); return this;}
+ public SubQuery with(Expr.Boolean... o) {query.with(o); return this;}
+
}
}
diff --git a/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlOps.java b/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlOps.java
index de4c73673..b7a1039da 100644
--- a/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlOps.java
+++ b/querydsl-hql/src/main/java/com/mysema/query/grammar/HqlOps.java
@@ -5,10 +5,17 @@
*/
package com.mysema.query.grammar;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
-import com.mysema.query.grammar.PathMetadata.PathType;
-import com.mysema.query.grammar.PathMetadata.PathTypeImpl;
+import com.mysema.query.grammar.Ops;
+import com.mysema.query.grammar.Ops.Op;
+import com.mysema.query.grammar.Ops.OpImpl;
+import com.mysema.query.grammar.types.PathMetadata.PathType;
+import com.mysema.query.grammar.types.PathMetadata.PathTypeImpl;
/**
* Ops provides
@@ -16,7 +23,7 @@ import com.mysema.query.grammar.PathMetadata.PathTypeImpl;
* @author tiwe
* @version $Id$
*/
-public class HqlOps extends Ops {
+public class HqlOps {
public static final Set> wrapCollectionsForOp;
@@ -31,36 +38,36 @@ public class HqlOps extends Ops {
wrapCollectionsForOp = Collections.unmodifiableSet(ops);
}
- private static final Map,String> patterns = new HashMap,String>();
+ private static final Map,java.lang.String> patterns = new HashMap,java.lang.String>();
private static final Map,Integer> precedence = new HashMap,Integer>();
static{
// boolean
- add(OpBoolean.AND, "%s and %s",36);
- add(OpBoolean.NOT, "not %s",3);
- add(OpBoolean.OR, "%s or %s",38);
- add(OpBoolean.XNOR, "%s xnor %s",39);
- add(OpBoolean.XOR, "%s xor %s",39);
+ add(Ops.AND, "%s and %s",36);
+ add(Ops.NOT, "not %s",3);
+ add(Ops.OR, "%s or %s",38);
+ add(Ops.XNOR, "%s xnor %s",39);
+ add(Ops.XOR, "%s xor %s",39);
// comparison
- add(OpComparable.BETWEEN, "%s between %s and %s",30);
- add(OpComparable.NOTBETWEEN, "%s not between %s and %s",30);
- add(OpComparable.GOE, "%s >= %s",20);
- add(OpComparable.GT, "%s > %s",21);
- add(OpComparable.LOE, "%s <= %s",22);
- add(OpComparable.LT, "%s < %s",23);
+ add(Ops.BETWEEN, "%s between %s and %s",30);
+ add(Ops.NOTBETWEEN, "%s not between %s and %s",30);
+ add(Ops.GOE, "%s >= %s",20);
+ add(Ops.GT, "%s > %s",21);
+ add(Ops.LOE, "%s <= %s",22);
+ add(Ops.LT, "%s < %s",23);
- add(OpDate.AFTER, "%s > %s",21);
- add(OpDate.BEFORE, "%s < %s",23);
+ add(Ops.AFTER, "%s > %s",21);
+ add(Ops.BEFORE, "%s < %s",23);
// numeric
- add(OpNumber.ADD, "%s + %s",13);
- add(OpNumber.DIV, "%s / %s",8);
- add(OpNumber.MOD, "%s % %s",10);
- add(OpNumber.MULT,"%s * %s",7);
- add(OpNumber.SUB, "%s - %s",12);
- add(OpNumber.SQRT, "sqrt(%s)");
+ add(Ops.ADD, "%s + %s",13);
+ add(Ops.DIV, "%s / %s",8);
+ add(Ops.MOD, "%s % %s",10);
+ add(Ops.MULT,"%s * %s",7);
+ add(Ops.SUB, "%s - %s",12);
+ add(Ops.SQRT, "sqrt(%s)");
// numeric aggregates
add(OpNumberAgg.AVG, "avg(%s)");
@@ -78,13 +85,13 @@ public class HqlOps extends Ops {
// add(Op.SIZE, "size(%s)");
// string
- add(OpString.CONCAT, "%s || %s",37);
- add(OpString.LIKE, "%s like %s",27);
- add(OpString.LOWER, "lower(%s)");
- add(OpString.SUBSTR1ARG, "substring(%s,%s)");
- add(OpString.SUBSTR2ARGS, "substring(%s,%s,%s)");
- add(OpString.TRIM, "trim(%s)");
- add(OpString.UPPER, "upper(%s)");
+ add(Ops.CONCAT, "%s || %s",37);
+ add(Ops.LIKE, "%s like %s",27);
+ add(Ops.LOWER, "lower(%s)");
+ add(Ops.SUBSTR1ARG, "substring(%s,%s)");
+ add(Ops.SUBSTR2ARGS, "substring(%s,%s,%s)");
+ add(Ops.TRIM, "trim(%s)");
+ add(Ops.UPPER, "upper(%s)");
// HQL specific
add(OpHql.SUM, "sum(%s)");
@@ -126,16 +133,16 @@ public class HqlOps extends Ops {
add(HqlPathType.MAPINDICES, "indices(%s)");
}
- private static void add(Op> op, String pattern){
+ private static void add(Op> op, java.lang.String pattern){
patterns.put(op, pattern);
}
- private static void add(Op> op, String pattern, int pre){
+ private static void add(Op> op, java.lang.String pattern, int pre){
patterns.put(op, pattern);
precedence.put(op,pre);
}
- public static String getPattern(Op> op){
+ public static java.lang.String getPattern(Op> op){
return patterns.get(op);
}
@@ -148,31 +155,31 @@ public class HqlOps extends Ops {
}
public interface OpHql{
- Op CURRENT_DATE = new OpImpl();
- Op CURRENT_TIME = new OpImpl();
- Op CURRENT_TIMESTAMP = new OpImpl();
- Op DAY = new OpImpl();
- Op HOUR = new OpImpl();
- Op ISEMPTY = new OpImpl();
- Op ISNOTEMPTY = new OpImpl();
- Op MINUTE = new OpImpl();
- Op MONTH = new OpImpl();
- Op SECOND = new OpImpl();
- Op SUM = new OpImpl();
- Op SYSDATE = new OpImpl();
- Op YEAR = new OpImpl();
+ Op CURRENT_DATE = new OpImpl();
+ Op CURRENT_TIME = new OpImpl();
+ Op CURRENT_TIMESTAMP = new OpImpl();
+ Op DAY = new OpImpl();
+ Op HOUR = new OpImpl();
+ Op ISEMPTY = new OpImpl();
+ Op ISNOTEMPTY = new OpImpl();
+ Op MINUTE = new OpImpl();
+ Op MONTH = new OpImpl();
+ Op SECOND = new OpImpl();
+ Op SUM = new OpImpl();
+ Op SYSDATE = new OpImpl();
+ Op YEAR = new OpImpl();
}
public interface OpNumberAgg{
- Op AVG = new OpImpl();
- Op MAX = new OpImpl();
- Op MIN = new OpImpl();
+ Op AVG = new OpImpl();
+ Op MAX = new OpImpl();
+ Op MIN = new OpImpl();
}
public interface OpQuant{
- Op AVG_IN_COL = new OpImpl();
- Op MAX_IN_COL = new OpImpl();
- Op