public static java.lang.Object | invokeJavaObjectMethod(java.lang.reflect.InvocationHandler handler, java.lang.reflect.Method method, java.lang.Object[] args)
Object returnValue = null;
// Can only be one of :
// boolean java.lang.Object.equals(Object)
// int java.lang.Object.hashCode()
// String java.lang.Object.toString()
//
// Optimize by comparing as few characters as possible.
switch( method.getName().charAt(0) ) {
case 'e" :
Object other = Proxy.isProxyClass(args[0].getClass()) ?
Proxy.getInvocationHandler(args[0]) : args[0];
returnValue = new Boolean(handler.equals(other));
break;
case 'h" :
returnValue = new Integer(handler.hashCode());
break;
case 't" :
returnValue = handler.toString();
break;
default :
throw new EJBException(method.getName());
}
return returnValue;
|