/** * <p>Return an accessible method (that is, one that can be invoked via * reflection) with given name and a single parameter. If no such method * can be found, return <code>null</code>. * Basically, a convenience wrapper that constructs a <code>Class</code> * array for you.</p> * * @param clazz get method from this class * @param methodName get method with this name * @param parameterType taking this type of parameter * @return The accessible method */ public static Method getAccessibleMethod( final Class<?> clazz, final String methodName, final Class<?> parameterType) { final Class<?>[] parameterTypes = {parameterType}; return getAccessibleMethod(clazz, methodName, parameterTypes); }
/** * <p>Return an accessible method (that is, one that can be invoked via * reflection) with given name and a single parameter. If no such method * can be found, return <code>null</code>. * Basically, a convenience wrapper that constructs a <code>Class</code> * array for you.</p> * * @param clazz get method from this class * @param methodName get method with this name * @param parameterType taking this type of parameter * @return The accessible method */ public static Method getAccessibleMethod( final Class<?> clazz, final String methodName, final Class<?> parameterType) { final Class<?>[] parameterTypes = {parameterType}; return getAccessibleMethod(clazz, methodName, parameterTypes); }
/** * <p>Return an accessible property getter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param descriptor Property descriptor to return a getter for * @return The read method */ public Method getReadMethod(final PropertyDescriptor descriptor) { return (MethodUtils.getAccessibleMethod(descriptor.getReadMethod())); }
/** * Find a method on the specified class whose name matches methodName, * and whose signature is: * <code> public static void foo(Digester d, String patternPrefix);</code>. * * @return null if no such method exists. */ public static Method locateMethod(Class<?> rulesClass, String methodName) throws PluginException { Class<?>[] paramSpec = { Digester.class, String.class }; Method rulesMethod = MethodUtils.getAccessibleMethod( rulesClass, methodName, paramSpec); return rulesMethod; } }
/** * <p>Return an accessible property getter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param descriptor Property descriptor to return a getter for * @return The read method */ public Method getReadMethod(final PropertyDescriptor descriptor) { return (MethodUtils.getAccessibleMethod(descriptor.getReadMethod())); }
/** * <p>Return an accessible property getter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param clazz The class of the read method will be invoked on * @param descriptor Property descriptor to return a getter for * @return The read method */ Method getReadMethod(final Class<?> clazz, final PropertyDescriptor descriptor) { return (MethodUtils.getAccessibleMethod(clazz, descriptor.getReadMethod())); }
/** * <p>Return an accessible property getter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param clazz The class of the read method will be invoked on * @param descriptor Property descriptor to return a getter for * @return The read method */ Method getReadMethod(final Class<?> clazz, final PropertyDescriptor descriptor) { return (MethodUtils.getAccessibleMethod(clazz, descriptor.getReadMethod())); }
/** * <p>Return an accessible method (that is, one that can be invoked via * reflection) that implements the specified Method. If no such method * can be found, return <code>null</code>.</p> * * @param method The method that we wish to call * @return The accessible method */ public static Method getAccessibleMethod(final Method method) { // Make sure we have a method to check if (method == null) { return (null); } return getAccessibleMethod(method.getDeclaringClass(), method); }
/** * <p>Return an accessible method (that is, one that can be invoked via * reflection) that implements the specified Method. If no such method * can be found, return <code>null</code>.</p> * * @param method The method that we wish to call * @return The accessible method */ public static Method getAccessibleMethod(final Method method) { // Make sure we have a method to check if (method == null) { return (null); } return getAccessibleMethod(method.getDeclaringClass(), method); }
/** * <p>Return an accessible property setter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><em>Note:</em> This method does not work correctly with custom bean * introspection under certain circumstances. It may return {@code null} * even if a write method is defined for the property in question. Use * {@link #getWriteMethod(Class, PropertyDescriptor)} to be sure that the * correct result is returned.</p> * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param descriptor Property descriptor to return a setter for * @return The write method */ public Method getWriteMethod(final PropertyDescriptor descriptor) { return (MethodUtils.getAccessibleMethod(descriptor.getWriteMethod())); }
/** * <p>Return an accessible property setter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><em>Note:</em> This method does not work correctly with custom bean * introspection under certain circumstances. It may return {@code null} * even if a write method is defined for the property in question. Use * {@link #getWriteMethod(Class, PropertyDescriptor)} to be sure that the * correct result is returned.</p> * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param descriptor Property descriptor to return a setter for * @return The write method */ public Method getWriteMethod(final PropertyDescriptor descriptor) { return (MethodUtils.getAccessibleMethod(descriptor.getWriteMethod())); }
final String methodName = writeMethodNames.get(desc.getName()); if (methodName != null) { method = MethodUtils.getAccessibleMethod(beanCls, methodName, desc.getPropertyType()); if (method != null) {
final String methodName = writeMethodNames.get(desc.getName()); if (methodName != null) { method = MethodUtils.getAccessibleMethod(beanCls, methodName, desc.getPropertyType()); if (method != null) {
/** * <p>Return an accessible property setter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param clazz The class of the read method will be invoked on * @param descriptor Property descriptor to return a setter for * @return The write method * @since 1.9.1 */ public Method getWriteMethod(final Class<?> clazz, final PropertyDescriptor descriptor) { final BeanIntrospectionData data = getIntrospectionData(clazz); return (MethodUtils.getAccessibleMethod(clazz, data.getWriteMethod(clazz, descriptor))); }
/** * <p>Return an accessible property setter method for this property, * if there is one; otherwise return <code>null</code>.</p> * * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p> * * @param clazz The class of the read method will be invoked on * @param descriptor Property descriptor to return a setter for * @return The write method * @since 1.9.1 */ public Method getWriteMethod(final Class<?> clazz, final PropertyDescriptor descriptor) { final BeanIntrospectionData data = getIntrospectionData(clazz); return (MethodUtils.getAccessibleMethod(clazz, data.getWriteMethod(clazz, descriptor))); }
method = getAccessibleMethod (clazz, clazz.getMethod(methodName, parameterTypes)); cacheMethod(md, method);
((MappedPropertyDescriptor) descriptor). getMappedWriteMethod(); mappedWriteMethod = MethodUtils.getAccessibleMethod(bean.getClass(), mappedWriteMethod); if (mappedWriteMethod != null) { final Object[] params = new Object[2];
method = getAccessibleMethod (clazz, clazz.getMethod(methodName, parameterTypes)); cacheMethod(md, method);
readMethod = MethodUtils.getAccessibleMethod(bean.getClass(), readMethod); if (readMethod != null) { final Object[] keyArray = new Object[1];
writeMethod = ((MappedPropertyDescriptor) desc).getMappedWriteMethod(); writeMethod = MethodUtils.getAccessibleMethod(bean.getClass(), writeMethod);