MethodCoercions { public static Predicate<Method> matchMultiParameterMethod(final String methodName, final List<?> arguments) { return Predicates.and(matchMethodByName(methodName), matchMultiParameterMethod(arguments)); }  static Predicate<Method> matchSingleParameterMethod(final String methodName, final Object argument); static Maybe<?> tryFindAndInvokeSingleParameterMethod(final Object instance, final String methodName, final Object argument); static Predicate<Method> matchMultiParameterMethod(final String methodName, final List<?> arguments); static Predicate<Method> matchMethodByName(final String methodName); static Predicate<Method> matchMultiParameterMethod(final List<?> arguments); static Maybe<?> tryFindAndInvokeMultiParameterMethod(Object instanceOrClazz, Iterable<Method> methods, List<?> arguments); static Maybe<?> tryFindAndInvokeMultiParameterMethod(Object instance, String methodName, List<?> arguments); static Maybe<?> tryFindAndInvokeBestMatchingMethod(Object instance, String methodName, Object argument);  }
@Test public void testMatchMultiParameterMethod() throws Exception { Predicate<Method> predicate = MethodCoercions.matchMultiParameterMethod("multiParameterMethod", ImmutableList.of("true", "42")); assertFalse(predicate.apply(singleParameterMethod)); assertTrue(predicate.apply(multiParameterMethod)); assertFalse(predicate.apply(singleCollectionParameterMethod)); }
@Test public void testMatchMultiParameterMethodWithoutName() throws Exception { Predicate<Method> predicate = MethodCoercions.matchMultiParameterMethod(ImmutableList.of("true", "42")); assertFalse(predicate.apply(singleParameterMethod)); assertTrue(predicate.apply(multiParameterMethod)); assertFalse(predicate.apply(singleCollectionParameterMethod)); }