public Method create(String key) { String methodName = key; try { return new MethodKey(target.getClass(), methodName, parameterTypes).getMethod(); } catch (InvalidMethodKeyException e) { throw new MethodLookupException("Unable to resolve dispatch method " + e.getMethodKey() + "'; make sure the method name is correct and such a method is defined on targetClass " + target.getClass().getName(), e); } } };
public Method create(MethodKey key) { return key.getMethod(); } };
public Method create(MethodKey key) { return key.getMethod(); } };
public Object create(Object key) { return ((MethodKey) key).getMethod(); } };
public Object create(Object key) { return ((MethodKey) key).getMethod(); } };
public Method create(String key) { String methodName = key; try { return new MethodKey(target.getClass(), methodName, parameterTypes).getMethod(); } catch (InvalidMethodKeyException e) { throw new MethodLookupException("Unable to resolve dispatch method " + e.getMethodKey() + "'; make sure the method name is correct and such a method is defined on targetClass " + target.getClass().getName(), e); } } };
public Object create(Object key) { String methodName = (String) key; try { return new MethodKey(target.getClass(), methodName, parameterTypes).getMethod(); } catch (InvalidMethodKeyException e) { throw new MethodLookupException("Unable to resolve dispatch method " + e.getMethodKey() + "'; make sure the method name is correct and such a method is defined on targetClass " + target.getClass().getName(), e); } } };
public Object create(Object key) { String methodName = (String) key; try { return new MethodKey(target.getClass(), methodName, parameterTypes).getMethod(); } catch (InvalidMethodKeyException e) { throw new MethodLookupException("Unable to resolve dispatch method " + e.getMethodKey() + "'; make sure the method name is correct and such a method is defined on targetClass " + target.getClass().getName(), e); } } };
public void testGetMethodWithNoArgs() { MethodKey key = new MethodKey(File.class, "list"); Method m = key.getMethod(); assertEquals(LIST_NO_ARGS, m); }
public void testGetMethodWithSingleArg() { MethodKey key = new MethodKey(File.class, "list", FilenameFilter.class); Method m = key.getMethod(); assertEquals(LIST_FILENAME_FILTER, m); }
public void testGetMethodWithSingleNullArgAndValidMatch() { MethodKey key = new MethodKey(File.class, "list", new Class[] { null }); Method m = key.getMethod(); assertEquals(LIST_FILENAME_FILTER, m); }
/** * Factory method that creates a bean invoking action, an adapter that adapts a method on an abitrary {@link Object} * to the {@link Action} interface. This method is an atomic operation that returns a fully initialized Action. It * encapsulates the selection of the action implementation as well as the action assembly. * @param beanId the id of the bean to be adapted to an Action instance * @param beanFactory the bean factory where the bean is managed * @param methodSignature the method to invoke on the bean when the action is executed (required) * @param resultExposer the specification for what to do with the method return value (optional) * @param conversionService the conversion service to be used to convert method parameters (optional) * @param attributes attributes that may be used to affect the bean invoking action's construction * @return the fully configured bean invoking action instance */ public Action createBeanInvokingAction(String beanId, BeanFactory beanFactory, MethodSignature methodSignature, ActionResultExposer resultExposer, ConversionService conversionService, AttributeMap attributes) { Object bean = beanFactory.getBean(beanId); AbstractBeanInvokingAction action = new LocalBeanInvokingAction(methodSignature, bean); action.setMethodResultExposer(resultExposer); MethodKey methodKey = new MethodKey(bean.getClass(), methodSignature.getMethodName(), methodSignature .getParameters().getTypesArray()); action.setResultEventFactory(resultEventFactorySelector.forMethod(methodKey.getMethod())); action.setConversionService(conversionService); return action; } }
public void testGetMoreGenericMethod() { MethodKey key = new MethodKey(Object.class, "equals", Long.class); assertEquals(safeGetMethod(Object.class, "equals", new Class[] { Object.class }), key.getMethod()); }