mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
made query variable instance specific
This commit is contained in:
parent
e88dd07a01
commit
9c69da77e0
@ -14,13 +14,18 @@ package com.mysema.query;
|
||||
public enum JoinType {
|
||||
DEFAULT,
|
||||
INNERJOIN {
|
||||
public String toString(){ return "INNER JOIN"; }
|
||||
},
|
||||
JOIN,
|
||||
LEFTJOIN {
|
||||
public String toString(){ return "LEFT JOIN"; }
|
||||
},
|
||||
public String toString() {
|
||||
return "INNER JOIN";
|
||||
}
|
||||
},
|
||||
JOIN, LEFTJOIN {
|
||||
public String toString() {
|
||||
return "LEFT JOIN";
|
||||
}
|
||||
},
|
||||
FULLJOIN {
|
||||
public String toString(){ return "FULL JOIN"; }
|
||||
public String toString() {
|
||||
return "FULL JOIN";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,10 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.query.grammar.types.Expr.EComparable;
|
||||
import com.mysema.query.grammar.types.Expr.ENumber;
|
||||
import com.mysema.query.grammar.types.Expr.EString;
|
||||
import com.mysema.query.grammar.types.Path.*;
|
||||
|
||||
/**
|
||||
@ -22,7 +18,7 @@ import com.mysema.query.grammar.types.Path.*;
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface ExprFactory {
|
||||
public interface PathFactory {
|
||||
|
||||
<D> Expr<D> createAny(D arg);
|
||||
|
||||
@ -14,7 +14,8 @@ import com.mysema.query.util.Assert;
|
||||
public class QueryAdapter<SubType extends QueryAdapter<SubType>> implements Query<SubType>{
|
||||
|
||||
private Query<?> query;
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private SubType _this = (SubType)this;
|
||||
|
||||
public QueryAdapter(){}
|
||||
|
||||
@ -17,10 +17,6 @@ import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.PathMetadata;
|
||||
import com.mysema.query.grammar.types.Expr.EBoolean;
|
||||
import com.mysema.query.grammar.types.Expr.EComparable;
|
||||
import com.mysema.query.grammar.types.Expr.ENumber;
|
||||
import com.mysema.query.grammar.types.Expr.EString;
|
||||
import com.mysema.query.grammar.types.Path.*;
|
||||
|
||||
/**
|
||||
@ -29,7 +25,7 @@ import com.mysema.query.grammar.types.Path.*;
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SimpleExprFactory implements ExprFactory {
|
||||
public class SimplePathFactory implements PathFactory {
|
||||
|
||||
private final PString str = new PString(PathMetadata.forVariable("str"));
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mysema.query.SimpleExprFactory;
|
||||
import com.mysema.query.SimplePathFactory;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
import com.mysema.query.grammar.types.Path.*;
|
||||
|
||||
@ -19,11 +19,11 @@ import com.mysema.query.grammar.types.Path.*;
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AliasAwareExprFactory extends SimpleExprFactory{
|
||||
public class AliasAwarePathFactory extends SimplePathFactory{
|
||||
|
||||
private final AliasFactory aliasFactory;
|
||||
|
||||
public AliasAwareExprFactory(AliasFactory aliasFactory){
|
||||
public AliasAwarePathFactory(AliasFactory aliasFactory){
|
||||
this.aliasFactory = aliasFactory;
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mysema.query.ExprFactory;
|
||||
import com.mysema.query.alias.AliasAwareExprFactory;
|
||||
import com.mysema.query.PathFactory;
|
||||
import com.mysema.query.alias.AliasAwarePathFactory;
|
||||
import com.mysema.query.alias.AliasFactory;
|
||||
import com.mysema.query.alias.SimpleAliasFactory;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
@ -29,7 +29,7 @@ public class GrammarWithAlias extends Grammar{
|
||||
|
||||
private static final AliasFactory aliasFactory = new SimpleAliasFactory();
|
||||
|
||||
private static final ExprFactory exprFactory = new AliasAwareExprFactory(aliasFactory);
|
||||
private static final PathFactory pathFactory = new AliasAwarePathFactory(aliasFactory);
|
||||
|
||||
private static final PSimple<Object> it = new PSimple<Object>(Object.class,PathMetadata.forVariable("it"));
|
||||
|
||||
@ -46,79 +46,79 @@ public class GrammarWithAlias extends Grammar{
|
||||
}
|
||||
|
||||
public static PBoolean $(Boolean arg){
|
||||
return exprFactory.createBoolean(arg);
|
||||
return pathFactory.createBoolean(arg);
|
||||
}
|
||||
|
||||
public static <D extends Comparable<? super D>> PComparable<D> $(D arg){
|
||||
return exprFactory.createComparable(arg);
|
||||
return pathFactory.createComparable(arg);
|
||||
}
|
||||
|
||||
public static PNumber<BigDecimal> $(BigDecimal arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<BigInteger> $(BigInteger arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<Byte> $(Byte arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<Double> $(Double arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<Float> $(Float arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<Integer> $(Integer arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<Long> $(Long arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PNumber<Short> $(Short arg){
|
||||
return exprFactory.createNumber(arg);
|
||||
return pathFactory.createNumber(arg);
|
||||
}
|
||||
|
||||
public static PString $(String arg){
|
||||
return exprFactory.createString(arg);
|
||||
return pathFactory.createString(arg);
|
||||
}
|
||||
|
||||
public static PBooleanArray $(Boolean[] args){
|
||||
return exprFactory.createBooleanArray(args);
|
||||
return pathFactory.createBooleanArray(args);
|
||||
}
|
||||
|
||||
public static <D extends Comparable<? super D>> PComparableArray<D> $(D[] args){
|
||||
return exprFactory.createComparableArray(args);
|
||||
return pathFactory.createComparableArray(args);
|
||||
}
|
||||
|
||||
public static PStringArray $(String[] args){
|
||||
return exprFactory.createStringArray(args);
|
||||
return pathFactory.createStringArray(args);
|
||||
}
|
||||
|
||||
public static <D> PEntityCollection<D> $(Collection<D> args){
|
||||
return exprFactory.createEntityCollection(args);
|
||||
return pathFactory.createEntityCollection(args);
|
||||
}
|
||||
|
||||
public static <K,V> PEntityMap<K,V> $(Map<K,V> args){
|
||||
return exprFactory.createEntityMap(args);
|
||||
return pathFactory.createEntityMap(args);
|
||||
}
|
||||
|
||||
public static <D> PEntityList<D> $(List<D> args){
|
||||
return exprFactory.createEntityList(args);
|
||||
return pathFactory.createEntityList(args);
|
||||
}
|
||||
|
||||
public static <D> PEntity<D> $(D arg){
|
||||
return exprFactory.createEntity(arg);
|
||||
return pathFactory.createEntity(arg);
|
||||
}
|
||||
|
||||
public static <D> Expr<D> getAny(D arg){
|
||||
return exprFactory.createAny(arg);
|
||||
return pathFactory.createAny(arg);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user