protected boolean checkMethod(Method method) { return isCoreObjectMethod(method); }
/** * Checks whether a method is a core method from java.lang.Object. * Such methods often receive special treatment because they are * deemed fundamental enough to not be tampered with. * call toString() is an exception to allow overriding toString() by a closure specified in the map * * @param method the method to check * @return true if the method is deemed to be a core method */ public static boolean isCoreObjectMethod(Method method) { return ConversionHandler.isCoreObjectMethod(method) && !"toString".equals(method.getName()); } }
protected boolean checkMethod(Method method) { return isCoreObjectMethod(method); }
protected boolean checkMethod(Method method) { return isCoreObjectMethod(method); }
/** * Checks whether a method is a core method from java.lang.Object. * Such methods often receive special treatment because they are * deemed fundamental enough to not be tampered with. * call toString() is an exception to allow overriding toString() by a closure specified in the map * * @param method the method to check * @return true if the method is deemed to be a core method */ public static boolean isCoreObjectMethod(Method method) { return ConversionHandler.isCoreObjectMethod(method) && !"toString".equals(method.getName()); } }
/** * Checks whether a method is a core method from java.lang.Object. * Such methods often receive special treatment because they are * deemed fundamental enough to not be tampered with. * call toString() is an exception to allow overriding toString() by a closure specified in the map * * @param method the method to check * @return true if the method is deemed to be a core method */ public static boolean isCoreObjectMethod(Method method) { return ConversionHandler.isCoreObjectMethod(method) && !"toString".equals(method.getName()); } }
/** * This method is a default implementation for the invoke method given in * Invocationhandler. Any call to a method with a declaring class that is * not Object, excluding toString(), is redirected to invokeCustom. * Methods like equals and hashcode are called on the class itself instead * of the delegate because they are considered fundamental methods that should * not be overwritten. The toString() method gets special treatment as it is * deemed to be a method that you might wish to override when called from Groovy. * * In many scenarios, it is better to overwrite the invokeCustom method where * the core Object related methods are filtered out. * * @param proxy the proxy * @param method the method * @param args the arguments * @return the result of the invocation by method or delegate * @throws Throwable if caused by the delegate or the method * @see #invokeCustom(Object, Method, Object[]) * @see InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (!isCoreObjectMethod(method)) { return invokeCustom(proxy, method, args); } try { return method.invoke(this, args); } catch (InvocationTargetException ite) { throw ite.getTargetException(); } }
/** * This method is a default implementation for the invoke method given in * Invocationhandler. Any call to a method with a declaring class that is * not Object, excluding toString(), is redirected to invokeCustom. * Methods like equals and hashcode are called on the class itself instead * of the delegate because they are considered fundamental methods that should * not be overwritten. The toString() method gets special treatment as it is * deemed to be a method that you might wish to override when called from Groovy. * * In many scenarios, it is better to overwrite the invokeCustom method where * the core Object related methods are filtered out. * * @param proxy the proxy * @param method the method * @param args the arguments * @return the result of the invocation by method or delegate * @throws Throwable if caused by the delegate or the method * @see #invokeCustom(Object, Method, Object[]) * @see InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (!isCoreObjectMethod(method)) { return invokeCustom(proxy, method, args); } try { return method.invoke(this, args); } catch (InvocationTargetException ite) { throw ite.getTargetException(); } }
if (method.getName().indexOf('$') != -1 || Modifier.isFinal(method.getModifiers()) || ConversionHandler.isCoreObjectMethod(method)) continue; if (map.containsKey(method.getName())) {
if (method.getName().indexOf('$') != -1 || Modifier.isFinal(method.getModifiers()) || (!"toString".equals(method.getName()) && ConversionHandler.isCoreObjectMethod(method)) || containsEquivalentMethod(selectedMethods.values(), method)) continue;
if (method.getName().indexOf('$') != -1 || Modifier.isFinal(method.getModifiers()) || ConversionHandler.isCoreObjectMethod(method) || containsEquivalentMethod(selectedMethods.values(), method)) continue;
if (method.getName().indexOf('$') != -1 || Modifier.isFinal(method.getModifiers()) || ConversionHandler.isCoreObjectMethod(method) || containsEquivalentMethod(selectedMethods.values(), method)) continue;