@Test void getMethods() { List<Method> methods = ReflectionUtils.getMethods(Bar.class, "test"); Assertions.assertAll( () -> Assertions.assertEquals(1, methods.size()), () -> Assertions.assertEquals(Bar.class.getDeclaredMethod("test"), methods.get(0)) ); }
public static List<Method> getMethods(Class<?> clazz, String methodName) { return Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> method.getName().equals(methodName)) .collect(Collectors.toList()); }
ReflectionUtils { public static List<Method> getMethods(Class<?> clazz, String methodName) { return Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> method.getName().equals(methodName)) .collect(Collectors.toList()); } }
ReflectionUtils { public static List<Method> getMethods(Class<?> clazz, String methodName) { return Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> method.getName().equals(methodName)) .collect(Collectors.toList()); } private  ReflectionUtils(); }
ReflectionUtils { public static List<Method> getMethods(Class<?> clazz, String methodName) { return Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> method.getName().equals(methodName)) .collect(Collectors.toList()); } private  ReflectionUtils(); static Collection<E> getByModifier(E[] executables, int modifier); static Option<Method> getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes); static List<Method> getMethods(Class<?> clazz, String methodName); static Set<Method> getMethodsAnnotatedWith(Class<?> clazz, Class<? extends Annotation> annotation); static Collection<T> getStaticFieldValues(Class<?> clazz, Class<T> type); @SuppressWarnings("unchecked") static Collection<R> getFieldValues(Class<T> clazz, Class<R> type, @Nullable T instance); }
ReflectionUtils { public static List<Method> getMethods(Class<?> clazz, String methodName) { return Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> method.getName().equals(methodName)) .collect(Collectors.toList()); } private  ReflectionUtils(); static Collection<E> getByModifier(E[] executables, int modifier); static Option<Method> getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes); static List<Method> getMethods(Class<?> clazz, String methodName); static Set<Method> getMethodsAnnotatedWith(Class<?> clazz, Class<? extends Annotation> annotation); static Collection<T> getStaticFieldValues(Class<?> clazz, Class<T> type); @SuppressWarnings("unchecked") static Collection<R> getFieldValues(Class<T> clazz, Class<R> type, @Nullable T instance);  }