added checks for method invocations

This commit is contained in:
Timo Westkämper 2009-01-07 10:38:53 +00:00
parent 1b661ff026
commit 0fbf4ff5e8
2 changed files with 3 additions and 12 deletions

View File

@ -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

View File

@ -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();
}