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 77bec56bd..991d310d9 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
@@ -5,6 +5,8 @@
*/
package com.mysema.query.grammar;
+import java.util.Collection;
+
import com.mysema.query.grammar.Ops.OpNumberAgg;
import com.mysema.query.grammar.types.Alias;
import com.mysema.query.grammar.types.CollectionType;
@@ -466,10 +468,24 @@ public class Grammar extends Factory{
* @param right
* @return
*/
- public static EBoolean in(A left, CollectionType right){
+ public static EBoolean in(A left, CollectionType extends A> right){
return createBoolean(Ops.IN, createConstant(left), (Expr>)right);
}
+ /**
+ * Expr : left in right
+ * OR
+ * right contains left
+ *
+ * @param
+ * @param left
+ * @param right
+ * @return
+ */
+ public static EBoolean in(Expr left, Collection extends A> right){
+ return createBoolean(Ops.IN, left, createConstant(right));
+ }
+
/**
* Expr : left in rest
* OR
@@ -785,7 +801,7 @@ public class Grammar extends Factory{
* @param rest
* @return
*/
- public static > EBoolean notIn(Expr left, A... rest) {
+ public static EBoolean notIn(Expr left, A... rest) {
return createBoolean(Ops.NOTIN, left, createConstant(rest));
}
@@ -797,7 +813,7 @@ public class Grammar extends Factory{
* @param right
* @return
*/
- public static EBoolean notIn(Expr left, CollectionType right){
+ public static EBoolean notIn(Expr left, CollectionType extends A> right){
return createBoolean(Ops.NOTIN, left, (Expr>)right);
}
diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/types/Alias.java b/querydsl-core/src/main/java/com/mysema/query/grammar/types/Alias.java
index e18b70a10..f8eddba2a 100644
--- a/querydsl-core/src/main/java/com/mysema/query/grammar/types/Alias.java
+++ b/querydsl-core/src/main/java/com/mysema/query/grammar/types/Alias.java
@@ -5,7 +5,6 @@
*/
package com.mysema.query.grammar.types;
-import com.mysema.query.grammar.Grammar;
import com.mysema.query.grammar.types.Expr.EEntity;
import com.mysema.query.grammar.types.Expr.ESimple;
import com.mysema.query.grammar.types.Path.PEntity;
@@ -62,9 +61,6 @@ public interface Alias {
this.from = from;
this.to = to;
}
- public Expr as(String to) {
- return Grammar.as(this, to);
- }
public Expr> getFrom() {return from;}
public String getTo() {return to;}
}
diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/types/Expr.java b/querydsl-core/src/main/java/com/mysema/query/grammar/types/Expr.java
index 34f5f4977..b518d6db7 100644
--- a/querydsl-core/src/main/java/com/mysema/query/grammar/types/Expr.java
+++ b/querydsl-core/src/main/java/com/mysema/query/grammar/types/Expr.java
@@ -9,6 +9,7 @@ import static com.mysema.query.grammar.types.Factory.createBoolean;
import static com.mysema.query.grammar.types.Factory.createConstant;
import java.lang.reflect.Constructor;
+import java.util.Collection;
import org.apache.commons.lang.ClassUtils;
@@ -29,12 +30,25 @@ public abstract class Expr{
private final Class extends D> type;
private String toString;
- public Expr(Class extends D> type){this.type = type;}
- public EBoolean eq(D right){return Grammar.eq(this, right);}
- public EBoolean eq(Expr super D> right){return Grammar.eq(this, right);}
+ public Expr(Class extends D> type){this.type = type;}
public Class extends D> getType(){ return type;}
- public EBoolean ne(D right){return Grammar.ne(this, right);}
- public EBoolean ne(Expr super D> right){return Grammar.ne(this, right);}
+
+ // eq
+ public final EBoolean eq(D right){return Grammar.eq(this, right);}
+ public final EBoolean eq(Expr super D> right){return Grammar.eq(this, right);}
+
+ // ne
+ public final EBoolean ne(D right){return Grammar.ne(this, right);}
+ public final EBoolean ne(Expr super D> right){return Grammar.ne(this, right);}
+
+ // containment
+ public final EBoolean in(CollectionType extends D> arg) {return Grammar.in(this, arg);}
+ public final EBoolean in(Collection extends D> arg) {return Grammar.in(this, arg); }
+ public final EBoolean in(D... args) {return Grammar.in(this,args);}
+
+ public final EBoolean notIn(CollectionType extends D> arg) {return Grammar.notIn(this, arg);}
+ public final EBoolean notIn(Collection extends D> arg) {return Grammar.in(this, arg); }
+ public final EBoolean notIn(D...args) {return Grammar.notIn(this, args);}
public String toString(){
if (toString == null){
@@ -53,47 +67,42 @@ public abstract class Expr{
super(null, args);
this.elementType = type;
}
- public Class getElementType(){
+ public final Class getElementType(){
return elementType;
}
}
public static abstract class EBoolean extends EComparable{
private EBoolean not;
public EBoolean() {super(Boolean.class);}
- public EBoolean and(EBoolean right) {return Grammar.and(this, right);}
- public EBoolean not(){
+ public final EBoolean and(EBoolean right) {return Grammar.and(this, right);}
+ public final EBoolean not(){
return not == null ? not = Grammar.not(this) : not;
}
- public EBoolean or(EBoolean right) {return Grammar.or(this, right);}
+ public final EBoolean or(EBoolean right) {return Grammar.or(this, right);}
}
public static abstract class EComparable> extends ESimple{
public EComparable(Class extends D> type) {super(type);}
- public EBoolean after(D right) {return Grammar.after(this,right);}
- public EBoolean after(Expr right) {return Grammar.after(this,right);}
- public EBoolean aoe(D right) {return Grammar.aoe(this,right);}
- public EBoolean aoe(Expr right) {return Grammar.aoe(this,right);}
+ public final EBoolean after(D right) {return Grammar.after(this,right);}
+ public final EBoolean after(Expr right) {return Grammar.after(this,right);}
+ public final EBoolean aoe(D right) {return Grammar.aoe(this,right);}
+ public final EBoolean aoe(Expr right) {return Grammar.aoe(this,right);}
- public OrderSpecifier asc() {return Grammar.asc(this);}
- public EBoolean before(D right) {return Grammar.before(this,right);}
- public EBoolean before(Expr right) {return Grammar.before(this,right);}
- public EBoolean between(D first, D second) {return Grammar.between(this,first,second);}
+ public final OrderSpecifier asc() {return Grammar.asc(this);}
+ public final EBoolean before(D right) {return Grammar.before(this,right);}
+ public final EBoolean before(Expr right) {return Grammar.before(this,right);}
+ public final EBoolean between(D first, D second) {return Grammar.between(this,first,second);}
- public EBoolean between(Expr first, Expr second) {return Grammar.between(this,first,second);}
- public EBoolean boe(D right) {return Grammar.boe(this,right);}
+ public final EBoolean between(Expr first, Expr second) {return Grammar.between(this,first,second);}
+ public final EBoolean boe(D right) {return Grammar.boe(this,right);}
- public EBoolean boe(Expr right) {return Grammar.boe(this,right);}
+ public final EBoolean boe(Expr right) {return Grammar.boe(this,right);}
// cast methods
public > ENumber castToNum(Class type){
return Grammar.numericCast(this, type);
}
- public OrderSpecifier desc() {return Grammar.desc(this);}
- public EBoolean in(CollectionType arg) {return Grammar.in(this, arg);}
- public EBoolean in(D... args) {return Grammar.in(this,args);}
- public EBoolean notBetween(D first, D second) {return Grammar.notBetween(this, first, second);}
- public EBoolean notBetween(Expr first, Expr second) {return Grammar.notBetween(this,first,second);}
- public EBoolean notIn(CollectionType arg) {return Grammar.notIn(this, arg);}
-
- public EBoolean notIn(D...args) {return Grammar.notIn(this, args);}
+ public final OrderSpecifier desc() {return Grammar.desc(this);}
+ public final EBoolean notBetween(D first, D second) {return Grammar.notBetween(this, first, second);}
+ public final EBoolean notBetween(Expr first, Expr second) {return Grammar.notBetween(this,first,second);}
public EString stringValue(){
return Grammar.stringCast(this);
@@ -108,7 +117,7 @@ public abstract class Expr{
super(type);
this.args = args;
}
- public Expr>[] getArgs() {
+ public final Expr>[] getArgs() {
return args;
}
@@ -171,74 +180,72 @@ public abstract class Expr{
public static abstract class ENumber> extends EComparable{
public ENumber(Class extends D> type) {super(type);}
- public ENumber byteValue() { return castToNum(Byte.class); }
- public ENumber doubleValue() { return castToNum(Double.class); }
- public ENumber floatValue() { return castToNum(Float.class); }
+ public final ENumber byteValue() { return castToNum(Byte.class); }
+ public final ENumber doubleValue() { return castToNum(Double.class); }
+ public final ENumber floatValue() { return castToNum(Float.class); }
// with Java level cast
- public > EBoolean goe(A right) { return createBoolean(Ops.GOE, this, createConstant(NumberUtil.castTo(right,getType())));}
+ public final > EBoolean goe(A right) { return createBoolean(Ops.GOE, this, createConstant(NumberUtil.castTo(right,getType())));}
// without cast
- public > EBoolean goe(Expr right) {return createBoolean(Ops.GOE, this, right);}
- public > EBoolean gt(A right) { return createBoolean(Ops.GT, this, createConstant(NumberUtil.castTo(right,getType())));}
- public > EBoolean gt(Expr right) {return createBoolean(Ops.GT, this, right);}
+ public final > EBoolean goe(Expr right) {return createBoolean(Ops.GOE, this, right);}
+ public final > EBoolean gt(A right) { return createBoolean(Ops.GT, this, createConstant(NumberUtil.castTo(right,getType())));}
+ public final > EBoolean gt(Expr right) {return createBoolean(Ops.GT, this, right);}
public ENumber intValue() { return castToNum(Integer.class); }
- public > EBoolean loe(A right) { return createBoolean(Ops.LOE, this, createConstant(NumberUtil.castTo(right,getType())));}
- public > EBoolean loe(Expr right) {return createBoolean(Ops.LOE, this, right);}
- public ENumber longValue() { return castToNum(Long.class); }
- public > EBoolean lt(A right) { return createBoolean(Ops.LT, this, createConstant(NumberUtil.castTo(right,getType())));}
- public > EBoolean lt(Expr right) {return createBoolean(Ops.LT, this, right);}
- public ENumber shortValue() { return castToNum(Short.class); }
+ public final > EBoolean loe(A right) { return createBoolean(Ops.LOE, this, createConstant(NumberUtil.castTo(right,getType())));}
+ public final > EBoolean loe(Expr right) {return createBoolean(Ops.LOE, this, right);}
+ public final ENumber longValue() { return castToNum(Long.class); }
+ public final > EBoolean lt(A right) { return createBoolean(Ops.LT, this, createConstant(NumberUtil.castTo(right,getType())));}
+ public final > EBoolean lt(Expr right) {return createBoolean(Ops.LT, this, right);}
+ public final ENumber shortValue() { return castToNum(Short.class); }
}
public static abstract class ESimple extends Expr{
public ESimple(Class extends D> type) {super(type);}
- public Expr as(String to){return Grammar.as(this, to);}
- public EBoolean in(CollectionType arg) {return Grammar.in(this, arg);}
- public EBoolean in(D... args) {return Grammar.in(this,args);}
+ public final Expr as(String to){return Grammar.as(this, to);}
}
public static abstract class EString extends EComparable{
private EString lower, trim, upper;
public EString() {super(String.class);}
- public EString add(Expr str) {return Grammar.concat(this, str);}
- public EString add(String str) {return Grammar.concat(this, str);}
+ public final EString add(Expr str) {return Grammar.concat(this, str);}
+ public final EString add(String str) {return Grammar.concat(this, str);}
- public Expr charAt(Expr i) {return Grammar.charAt(this, i);}
- public Expr charAt(int i) {return Grammar.charAt(this, i);}
+ public final Expr charAt(Expr i) {return Grammar.charAt(this, i);}
+ public final Expr charAt(int i) {return Grammar.charAt(this, i);}
- public EString concat(Expr str) {return Grammar.concat(this, str);}
- public EString concat(String str) {return Grammar.concat(this, str);}
+ public final EString concat(Expr str) {return Grammar.concat(this, str);}
+ public final EString concat(String str) {return Grammar.concat(this, str);}
- public EBoolean contains(Expr str) {return Grammar.contains(this, str);}
- public EBoolean contains(String str) {return Grammar.contains(this, str);}
+ public final EBoolean contains(Expr str) {return Grammar.contains(this, str);}
+ public final EBoolean contains(String str) {return Grammar.contains(this, str);}
- public EBoolean endsWith(Expr str) {return Grammar.endsWith(this, str);}
- public EBoolean endsWith(String str) {return Grammar.endsWith(this, str);}
+ public final EBoolean endsWith(Expr str) {return Grammar.endsWith(this, str);}
+ public final EBoolean endsWith(String str) {return Grammar.endsWith(this, str);}
- public EBoolean equalsIgnoreCase(Expr str) {return Grammar.equalsIgnoreCase(this, str);}
- public EBoolean equalsIgnoreCase(String str) {return Grammar.equalsIgnoreCase(this, str);}
+ public final EBoolean equalsIgnoreCase(Expr str) {return Grammar.equalsIgnoreCase(this, str);}
+ public final EBoolean equalsIgnoreCase(String str) {return Grammar.equalsIgnoreCase(this, str);}
- public EComparable indexOf(Expr str) {return Grammar.indexOf(this, str);}
- public EComparable indexOf(String str) {return Grammar.indexOf(this, str);}
- public EComparable indexOf(String str, int i) {return Grammar.indexOf(this, str, i);}
- public EComparable lastIndex(String str, int i) {return Grammar.lastIndex(this, str, i);}
- public EComparable lastIndexOf(String str) {return Grammar.lastIndexOf(this, str);}
+ public final EComparable indexOf(Expr str) {return Grammar.indexOf(this, str);}
+ public final EComparable indexOf(String str) {return Grammar.indexOf(this, str);}
+ public final EComparable indexOf(String str, int i) {return Grammar.indexOf(this, str, i);}
+ public final EComparable lastIndex(String str, int i) {return Grammar.lastIndex(this, str, i);}
+ public final EComparable lastIndexOf(String str) {return Grammar.lastIndexOf(this, str);}
- public EComparable length() {return Grammar.length(this);}
+ public final EComparable length() {return Grammar.length(this);}
- public EBoolean like(String str) { return Grammar.like(this, str); }
+ public final EBoolean like(String str) { return Grammar.like(this, str); }
- public EString lower() { return lower == null ? lower = Grammar.lower(this) : lower; }
+ public final EString lower() { return lower == null ? lower = Grammar.lower(this) : lower; }
- public EBoolean startsWith(Expr str) {return Grammar.startsWith(this, str);}
- public EBoolean startsWith(String str) {return Grammar.startsWith(this, str);}
+ public final EBoolean startsWith(Expr str) {return Grammar.startsWith(this, str);}
+ public final EBoolean startsWith(String str) {return Grammar.startsWith(this, str);}
- public EString substring(int beginIndex) { return Grammar.substring(this, beginIndex);}
- public EString substring(int beginIndex, int endIndex) { return Grammar.substring(this, beginIndex, endIndex);}
+ public final EString substring(int beginIndex) { return Grammar.substring(this, beginIndex);}
+ public final EString substring(int beginIndex, int endIndex) { return Grammar.substring(this, beginIndex, endIndex);}
- public EString trim() { return trim == null ? trim = Grammar.trim(this) : trim; }
- public EString upper() { return upper == null ? upper = Grammar.upper(this) : upper; }
+ public final EString trim() { return trim == null ? trim = Grammar.trim(this) : trim; }
+ public final EString upper() { return upper == null ? upper = Grammar.upper(this) : upper; }
}
}
diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/types/Path.java b/querydsl-core/src/main/java/com/mysema/query/grammar/types/Path.java
index e258a17d5..ad95a207d 100644
--- a/querydsl-core/src/main/java/com/mysema/query/grammar/types/Path.java
+++ b/querydsl-core/src/main/java/com/mysema/query/grammar/types/Path.java
@@ -12,6 +12,7 @@ import static com.mysema.query.grammar.types.PathMetadata.forProperty;
import static com.mysema.query.grammar.types.PathMetadata.forSize;
import java.lang.reflect.Array;
+import java.util.Map;
import com.mysema.query.grammar.Grammar;
import com.mysema.query.grammar.types.Expr.*;
@@ -29,6 +30,7 @@ public interface Path {
Path> getRoot();
EBoolean isnotnull();
EBoolean isnull();
+ Class extends C> getType();
public static abstract class PArray extends Expr implements Path, CollectionType{
protected final Class arrayType;
@@ -353,7 +355,6 @@ public interface Path {
public Alias.AEntity as(PEntity to) {return Grammar.as(this, to);}
public String getEntityName(){ return entityName; }
public PathMetadata> getMetadata() {return metadata;}
- public EBoolean in(CollectionType right){return Grammar.in(this, right);}
public EBoolean isnotnull() {
return isnotnull == null ? isnotnull = Grammar.isnotnull(this) : isnotnull;
}
@@ -435,7 +436,7 @@ public interface Path {
}
- public static class PEntityMap extends EEntity> implements PMap{
+ public static class PEntityMap extends EEntity