mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
added Checkstyle comments
This commit is contained in:
parent
ab0a5e3ecd
commit
ea57ccef1b
@ -47,6 +47,8 @@ public final class Alias {
|
||||
|
||||
private static final PSimple<Object> it = new PSimple<Object>(Object.class, PathMetadataFactory.forVariable("it"));
|
||||
|
||||
// exclude $-methods from Checkstyle checks
|
||||
//CHECKSTYLE:OFF
|
||||
/**
|
||||
* Convert the given alias to an expression
|
||||
*
|
||||
@ -145,6 +147,7 @@ public final class Alias {
|
||||
public static PDateTime<Timestamp> $(Timestamp arg) {
|
||||
return aliasFactory.<PDateTime<Timestamp>> getCurrentAndReset();
|
||||
}
|
||||
//CHECKSTYLE:ON
|
||||
|
||||
public static <A> A alias(Class<A> cl) {
|
||||
return alias(cl, StringUtils.uncapitalize(cl.getSimpleName()));
|
||||
|
||||
@ -56,7 +56,7 @@ import com.mysema.util.ReflectionUtils;
|
||||
*/
|
||||
class PropertyAccessInvocationHandler implements MethodInterceptor {
|
||||
|
||||
private final Expr<?> path;
|
||||
private final Expr<?> hostExpression;
|
||||
|
||||
private final AliasFactory aliasFactory;
|
||||
|
||||
@ -64,12 +64,14 @@ class PropertyAccessInvocationHandler implements MethodInterceptor {
|
||||
|
||||
private final Map<Object, Object> propToObj = new HashMap<Object, Object>();
|
||||
|
||||
public PropertyAccessInvocationHandler(Expr<?> path, AliasFactory aliasFactory) {
|
||||
this.path = path;
|
||||
public PropertyAccessInvocationHandler(Expr<?> host, AliasFactory aliasFactory) {
|
||||
this.hostExpression = host;
|
||||
this.aliasFactory = aliasFactory;
|
||||
}
|
||||
|
||||
//CHECKSTYLE:OFF
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
//CHECKSTYLE:ON
|
||||
Object rv = null;
|
||||
|
||||
MethodType methodType = MethodType.get(method);
|
||||
@ -82,7 +84,7 @@ class PropertyAccessInvocationHandler implements MethodInterceptor {
|
||||
if (propToObj.containsKey(ptyName)) {
|
||||
rv = propToObj.get(ptyName);
|
||||
} else {
|
||||
PathMetadata<String> pm = PathMetadataFactory.forProperty((Path<?>) path, ptyName);
|
||||
PathMetadata<String> pm = PathMetadataFactory.forProperty((Path<?>) hostExpression, ptyName);
|
||||
rv = newInstance(ptyClass, genericType, proxy, ptyName, pm);
|
||||
}
|
||||
aliasFactory.setCurrent(propToExpr.get(ptyName));
|
||||
@ -103,8 +105,8 @@ class PropertyAccessInvocationHandler implements MethodInterceptor {
|
||||
if (propToObj.containsKey(propKey)) {
|
||||
rv = propToObj.get(propKey);
|
||||
} else {
|
||||
PathMetadata<Integer> pm = PathMetadataFactory.forListAccess((PList<?, ?>) path, (Integer) args[0]);
|
||||
Class<?> elementType = ((ECollection<?,?>) path).getElementType();
|
||||
PathMetadata<Integer> pm = PathMetadataFactory.forListAccess((PList<?, ?>) hostExpression, (Integer) args[0]);
|
||||
Class<?> elementType = ((ECollection<?,?>) hostExpression).getElementType();
|
||||
rv = newInstance(elementType, elementType, proxy, propKey, pm);
|
||||
}
|
||||
aliasFactory.setCurrent(propToExpr.get(propKey));
|
||||
@ -114,20 +116,20 @@ class PropertyAccessInvocationHandler implements MethodInterceptor {
|
||||
if (propToObj.containsKey(propKey)) {
|
||||
rv = propToObj.get(propKey);
|
||||
} else {
|
||||
PathMetadata<?> pm = PathMetadataFactory.forMapAccess((PMap<?, ?, ?>) path, args[0]);
|
||||
Class<?> valueType = ((EMap<?, ?>) path).getValueType();
|
||||
PathMetadata<?> pm = PathMetadataFactory.forMapAccess((PMap<?, ?, ?>) hostExpression, args[0]);
|
||||
Class<?> valueType = ((EMap<?, ?>) hostExpression).getValueType();
|
||||
rv = newInstance(valueType, valueType, proxy, propKey, pm);
|
||||
}
|
||||
aliasFactory.setCurrent(propToExpr.get(propKey));
|
||||
|
||||
} else if (methodType == MethodType.TO_STRING) {
|
||||
rv = path.toString();
|
||||
rv = hostExpression.toString();
|
||||
|
||||
} else if (methodType == MethodType.HASH_CODE) {
|
||||
rv = path.hashCode();
|
||||
rv = hostExpression.hashCode();
|
||||
|
||||
} else if (methodType == MethodType.GET_MAPPED_PATH) {
|
||||
rv = path;
|
||||
rv = hostExpression;
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invocation of " + method.getName() + " not supported");
|
||||
|
||||
@ -68,8 +68,4 @@ public class CBoolean extends EBoolean implements Custom<Boolean> {
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<Boolean> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -70,9 +70,5 @@ public class CComparable<T extends Comparable<?>> extends EComparable<T> impleme
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<T> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -68,9 +68,5 @@ public class CDate<T extends Comparable<?>> extends EDate<T> implements Custom<T
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<T> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -68,10 +68,5 @@ public class CDateTime<T extends Comparable<?>> extends EDateTime<T> implements
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<T> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -70,8 +70,4 @@ public class CNumber<T extends Number & Comparable<?>> extends ENumber<T> implem
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<T> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -69,8 +69,4 @@ public class CSimple<T> extends Expr<T> implements Custom<T> {
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<T> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -68,8 +68,4 @@ public class CString extends EString implements Custom<String> {
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<String> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -69,9 +69,4 @@ public class CTime<T extends Comparable<?>> extends ETime<T> implements Custom<T
|
||||
return getType().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<T> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -54,6 +54,13 @@ public abstract class Expr<D> implements Serializable{
|
||||
|
||||
public abstract void accept(Visitor v);
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Expr<D> asExpr(){
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>count(this)</code> expression
|
||||
*
|
||||
|
||||
@ -41,12 +41,6 @@ public class OBoolean extends EBoolean implements Operation<Boolean, Boolean> {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EBoolean asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
return opMixin.getArg(index);
|
||||
|
||||
@ -55,11 +55,6 @@ public class OComparable<OpType, D extends Comparable<?>> extends
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EComparable<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
return opMixin.getArg(index);
|
||||
|
||||
@ -55,11 +55,6 @@ public class ODate <OpType extends Comparable<?>, D extends Comparable<?>> exten
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EDate<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
return opMixin.getArg(index);
|
||||
|
||||
@ -56,11 +56,6 @@ public class ODateTime<OpType extends Comparable<?>, D extends Comparable<?>> ex
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EDateTime<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
return opMixin.getArg(index);
|
||||
|
||||
@ -55,11 +55,6 @@ public class ONumber<OpType extends Number, D extends Number & Comparable<?>>
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
return opMixin.getArg(index);
|
||||
|
||||
@ -53,11 +53,6 @@ public class OSimple<OpType, D> extends Expr<D> implements Operation<OpType, D>
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
return opMixin.getArg(index);
|
||||
|
||||
@ -40,11 +40,6 @@ public class OString extends EString implements Operation<String, String> {
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EString asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
|
||||
@ -53,11 +53,6 @@ public class OTime<OpType, D extends Comparable<?>> extends ETime<D> implements
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ETime<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<?> getArg(int index) {
|
||||
|
||||
@ -49,11 +49,6 @@ public class PArray<E> extends Expr<E[]> implements Path<E[]>, EArray<E>{
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<E[]> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -39,11 +39,6 @@ public class PBoolean extends EBoolean implements Path<Boolean> {
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EBoolean asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@ -44,11 +44,6 @@ public class PCollection<E> extends ECollectionBase<Collection<E>,E> implements
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<Collection<E>> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -47,11 +47,6 @@ public class PComparable<D extends Comparable> extends EComparable<D> implements
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EComparable<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@ -40,11 +40,6 @@ public class PDate<D extends Comparable> extends EDate<D> implements Path<D>{
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EDate<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@ -40,11 +40,6 @@ public class PDateTime<D extends Comparable> extends EDateTime<D> implements Pat
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EDateTime<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@ -91,11 +91,6 @@ public class PEntity<D> extends Expr<D> implements Path<D> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param <A>
|
||||
* @param property
|
||||
|
||||
@ -70,11 +70,6 @@ public class PList<E, Q extends Expr<E>> extends ECollectionBase<List<E>,E> impl
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<List<E>> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected PathMetadata<Integer> forListAccess(int index){
|
||||
return PathMetadataFactory.forListAccess(this, index);
|
||||
}
|
||||
|
||||
@ -76,11 +76,6 @@ public class PMap<K, V, E extends Expr<V>> extends EMapBase<K, V> implements Pat
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PMap<K,V,E> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -42,11 +42,6 @@ public class PNumber<D extends Number & Comparable<?>> extends ENumber<D> implem
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -44,11 +44,6 @@ public class PSet<E> extends ECollectionBase<Set<E>,E> implements Path<Set<E>> {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<Set<E>> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -42,11 +42,6 @@ public class PSimple<D> extends Expr<D> implements Path<D> {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -40,11 +40,6 @@ public class PString extends EString implements Path<String> {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EString asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return pathMixin.equals(o);
|
||||
|
||||
@ -39,11 +39,6 @@ public class PTime<D extends Comparable> extends ETime<D> implements Path<D>{
|
||||
public void accept(Visitor v) {
|
||||
v.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ETime<D> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@ -56,8 +56,4 @@ public final class BooleanSubQuery extends EBoolean implements SubQuery<Boolean>
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<Boolean> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,4 @@ public final class ComparableSubQuery<A extends Comparable<?>> extends EComparab
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<A> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,4 @@ public final class DateSubQuery<A extends Comparable<?>> extends EDate<A> implem
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<A> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,4 @@ public final class DateTimeSubQuery<A extends Comparable<?>> extends EDateTime<A
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<A> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,9 +70,5 @@ public final class ListSubQuery<A> extends ECollectionBase<List<A>,A> implements
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<List<A>> asExpr() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -61,8 +61,4 @@ public final class NumberSubQuery<A extends Number & Comparable<?>> extends ENum
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<A> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,8 +59,4 @@ public final class ObjectSubQuery<A> extends Expr<A> implements SubQuery<A>{
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<A> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,8 +57,4 @@ public final class StringSubQuery extends EString implements SubQuery<String>{
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<String> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,8 +60,4 @@ public final class TimeSubQuery<A extends Comparable<?>> extends ETime<A> implem
|
||||
return subQueryMixin.notExists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr<A> asExpr() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user