Wrapper { public boolean hasMethod(String name) { for (String mn : getMethodNames()) { if (mn.equals(name)) { return true; } } return false; }  static Wrapper getWrapper(Class<?> c); abstract String[] getPropertyNames(); abstract Class<?> getPropertyType(String pn); abstract boolean hasProperty(String name); abstract Object getPropertyValue(Object instance, String pn); abstract void setPropertyValue(Object instance, String pn, Object pv); Object[] getPropertyValues(Object instance, String[] pns); void setPropertyValues(Object instance, String[] pns, Object[] pvs); abstract String[] getMethodNames(); abstract String[] getDeclaredMethodNames(); boolean hasMethod(String name); abstract Object invokeMethod(Object instance, String mn, Class<?>[] types, Object[] args);  }
@Test public void testHasMethod() throws Exception { Wrapper w = Wrapper.getWrapper(I1.class); Assertions.assertTrue(w.hasMethod("setName")); Assertions.assertTrue(w.hasMethod("hello")); Assertions.assertTrue(w.hasMethod("showInt")); Assertions.assertTrue(w.hasMethod("getFloat")); Assertions.assertTrue(w.hasMethod("setFloat")); Assertions.assertFalse(w.hasMethod("setFloatXXX")); }