@Test public void findMethodNamedテスト正常系2() { Method equals = Reflects.findMethodNamed("equals", getClass()); assertNotNull(equals); assertEquals("equals", equals.getName()); assertEquals(1, equals.getParameterTypes().length); assertEquals(Object.class, equals.getParameterTypes()[0]); }
public static Method findMethodNamed(String name, Class<?> target) { Args.checkNotEmpty(name); return findMethodNamed(Pattern.compile(name), target); }
Reflects { public static Method findMethodNamed(String name, Class<?> target) { Args.checkNotEmpty(name); return findMethodNamed(Pattern.compile(name), target); } }
Reflects { public static Method findMethodNamed(String name, Class<?> target) { Args.checkNotEmpty(name); return findMethodNamed(Pattern.compile(name), target); } private  Reflects(); }
Reflects { public static Method findMethodNamed(String name, Class<?> target) { Args.checkNotEmpty(name); return findMethodNamed(Pattern.compile(name), target); } private  Reflects(); static Method findMethodSigned(String name, Class<?> target, Class<?>... argumentTypes); static Method findMethodNamed(String name, Class<?> target); static Method findMethodNamed(Pattern pattern, Class<?> target); static Field findFieldNamed(String name, Class<?> target); static Field findFieldNamed(Pattern pattern, Class<?> target); static Constructor<T> findConstructorFor(Class<T> target, Class<?>... argumentTypes); static Object invoke(Method method, Object instance, Object... arguments); static Object read(Field field, Object instance); static void write(Field field, Object instance, Object newValue); static T invoke(Constructor<T> con, Object... arguments); static T make(Class<T> clazz, Object... args); static Method[] findAllMethods(Class<?> clazz); static Field[] findAllFields(Class<?> clazz); }
Reflects { public static Method findMethodNamed(String name, Class<?> target) { Args.checkNotEmpty(name); return findMethodNamed(Pattern.compile(name), target); } private  Reflects(); static Method findMethodSigned(String name, Class<?> target, Class<?>... argumentTypes); static Method findMethodNamed(String name, Class<?> target); static Method findMethodNamed(Pattern pattern, Class<?> target); static Field findFieldNamed(String name, Class<?> target); static Field findFieldNamed(Pattern pattern, Class<?> target); static Constructor<T> findConstructorFor(Class<T> target, Class<?>... argumentTypes); static Object invoke(Method method, Object instance, Object... arguments); static Object read(Field field, Object instance); static void write(Field field, Object instance, Object newValue); static T invoke(Constructor<T> con, Object... arguments); static T make(Class<T> clazz, Object... args); static Method[] findAllMethods(Class<?> clazz); static Field[] findAllFields(Class<?> clazz);  }