mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-24 21:07:26 +08:00
added checks for method invocations
This commit is contained in:
parent
1b661ff026
commit
0fbf4ff5e8
@ -100,10 +100,6 @@ class PropertyAccessInvocationHandler implements MethodInterceptor{
|
||||
}
|
||||
aliasFactory.setCurrent(propToExpr.get(ptyName));
|
||||
|
||||
}else if (isEquals(method)){
|
||||
rv = methodProxy.invokeSuper(proxy, args);
|
||||
aliasFactory.setCurrent(((Expr<Object>)parent).eq(args[0]));
|
||||
|
||||
}else if (isContains(method)){
|
||||
rv = false;
|
||||
aliasFactory.setCurrent(Grammar.in(args[0], (CollectionType<Object>)parent));
|
||||
@ -118,7 +114,8 @@ class PropertyAccessInvocationHandler implements MethodInterceptor{
|
||||
valueType = (Class<?>) args[0];
|
||||
|
||||
}else{
|
||||
rv = methodProxy.invokeSuper(proxy, args);
|
||||
// rv = methodProxy.invokeSuper(proxy, args);
|
||||
throw new IllegalArgumentException("Invocation of " + method.getName() + " not supported");
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -134,12 +131,6 @@ class PropertyAccessInvocationHandler implements MethodInterceptor{
|
||||
&& method.getParameterTypes().length == 1
|
||||
&& method.getParameterTypes()[0].equals(int.class);
|
||||
}
|
||||
|
||||
private boolean isEquals(Method method){
|
||||
return method.getName().equals("equals")
|
||||
&& method.getReturnType().equals(boolean.class)
|
||||
&& method.getParameterTypes().length == 1;
|
||||
}
|
||||
|
||||
private boolean isGetter(Method method){
|
||||
return method.getParameterTypes().length == 0
|
||||
|
||||
@ -154,7 +154,7 @@ public class MiniApiTest {
|
||||
Cat other = new Cat();
|
||||
|
||||
from($(c),cats)
|
||||
.where($(c.equals(other)))
|
||||
.where($(c).eq(other))
|
||||
.iterate($(c)).iterator();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user