/** * Determine whether the given method is a "hashCode" method. * @see java.lang.Object#hashCode */ public static boolean isHashCodeMethod(@Nullable Method method) { return ReflectionUtils.isHashCodeMethod(method); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (ReflectionUtils.isHashCodeMethod(method)) { // Use hashCode of service locator proxy. return System.identityHashCode(proxy); } else if (ReflectionUtils.isToStringMethod(method)) { return "Service locator: " + serviceLocatorInterface; } else { return invokeServiceLocatorMethod(method, args); } }
@Override @Nullable public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { return (isProxyForSameBshObject(args[0])); } else if (ReflectionUtils.isHashCodeMethod(method)) { return this.xt.hashCode(); } else if (ReflectionUtils.isToStringMethod(method)) { return "BeanShell object [" + this.xt + "]"; } try { Object result = this.xt.invokeMethod(method.getName(), args); if (result == Primitive.NULL || result == Primitive.VOID) { return null; } if (result instanceof Primitive) { return ((Primitive) result).getValue(); } return result; } catch (EvalError ex) { throw new BshExecutionException(ex); } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (ReflectionUtils.isHashCodeMethod(method)) { // Use hashCode of service locator proxy. return System.identityHashCode(proxy); } else if (ReflectionUtils.isToStringMethod(method)) { return "Service locator: " + serviceLocatorInterface; } else { return invokeServiceLocatorMethod(method, args); } }
@Override @Nullable public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { return (isProxyForSameBshObject(args[0])); } else if (ReflectionUtils.isHashCodeMethod(method)) { return this.xt.hashCode(); } else if (ReflectionUtils.isToStringMethod(method)) { return "BeanShell object [" + this.xt + "]"; } try { Object result = this.xt.invokeMethod(method.getName(), args); if (result == Primitive.NULL || result == Primitive.VOID) { return null; } if (result instanceof Primitive) { return ((Primitive) result).getValue(); } return result; } catch (EvalError ex) { throw new BshExecutionException(ex); } }
if (ReflectionUtils.isHashCodeMethod(method)) { return proxyHashCode(proxy);
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { return annotationEquals(args[0]); } if (ReflectionUtils.isHashCodeMethod(method)) { return annotationHashCode(); } if (ReflectionUtils.isToStringMethod(method)) { return annotationToString(); } if (AnnotationUtils.isAnnotationTypeMethod(method)) { return annotationType(); } if (!AnnotationUtils.isAttributeMethod(method)) { throw new AnnotationConfigurationException(String.format( "Method [%s] is unsupported for synthesized annotation type [%s]", method, annotationType())); } return getAttributeValue(method); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { return annotationEquals(args[0]); } if (ReflectionUtils.isHashCodeMethod(method)) { return annotationHashCode(); } if (ReflectionUtils.isToStringMethod(method)) { return annotationToString(); } if (AnnotationUtils.isAnnotationTypeMethod(method)) { return annotationType(); } if (!AnnotationUtils.isAttributeMethod(method)) { throw new AnnotationConfigurationException(String.format( "Method [%s] is unsupported for synthesized annotation type [%s]", method, annotationType())); } return getAttributeValue(method); }
private static boolean isMethodDefinedOnObjectClass(Method method) { return method != null && (method.getDeclaringClass().equals(Object.class) || ReflectionUtils.isEqualsMethod(method) || ReflectionUtils.isHashCodeMethod(method) || ReflectionUtils.isToStringMethod(method) || AopUtils.isFinalizeMethod(method) || (method.getName().equals("clone") && method.getParameterTypes().length == 0)); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ReflectionUtils.isEqualsMethod(method)) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (ReflectionUtils.isHashCodeMethod(method)) { // Use hashCode of service locator proxy. return System.identityHashCode(proxy); } else if (ReflectionUtils.isToStringMethod(method)) { return "Service locator: " + serviceLocatorInterface.getName(); } else { return invokeServiceLocatorMethod(method, args); } }
public int accept(Method method) { if (isEqualsMethod(method) || isHashCodeMethod(method) || isToStringMethod(method) || isProxyTargetFactoryMethod(method)) { return 0; // invoke super } else { return 1; // invoke proxied object } }
public int accept(Method method) { if (isEqualsMethod(method) || isHashCodeMethod(method) || isToStringMethod(method) || isProxyTargetFactoryMethod(method)) { return 0; // invoke super } else { return 1; // invoke proxied object } }
public int accept(Method method) { if (isEqualsMethod(method) || isHashCodeMethod(method) || isToStringMethod(method) || isProxyTargetFactoryMethod(method)) { return 0; // invoke super } else { return 1; // invoke proxied object } }
if (ReflectionUtils.isHashCodeMethod(method)) { return proxyHashCode(proxy);
/** * Determine whether the given method is a "hashCode" method. * @see java.lang.Object#hashCode */ public static boolean isHashCodeMethod(Method method) { return ReflectionUtils.isHashCodeMethod(method); }
/** * Determine whether the given method is a "hashCode" method. * @see java.lang.Object#hashCode */ public static boolean isHashCodeMethod(@Nullable Method method) { return ReflectionUtils.isHashCodeMethod(method); }
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (found.value || method.getDeclaringClass() == Object.class) { return; } if (ReflectionUtils.isHashCodeMethod(method)) { found.value = true; } } });
private static boolean isMethodDefinedOnObjectClass(Method method) { return method != null && (method.getDeclaringClass().equals(Object.class) || ReflectionUtils.isEqualsMethod(method) || ReflectionUtils.isHashCodeMethod(method) || ReflectionUtils.isToStringMethod(method) || AopUtils.isFinalizeMethod(method) || (method.getName().equals("clone") && method.getParameterTypes().length == 0)); }
public int accept(Method method) { if (isEqualsMethod(method) || isHashCodeMethod(method) || isToStringMethod(method) || isProxyTargetFactoryMethod(method)) { return 0; // invoke super } else { return 1; // invoke proxied object } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object ret = method.invoke(delegate, args); if (!ReflectionUtils.isEqualsMethod(method) && !ReflectionUtils.isHashCodeMethod(method) && !ReflectionUtils.isToStringMethod(method) && isAttributeMethod(method)) { return resolvePlaceHolder(ret); } return ret; }