ReflectUtils { protected static boolean isBeanPropertyWriteMethod(Method method) { return method != null && Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()) && method.getDeclaringClass() != Object.class && method.getParameterTypes().length == 1 && method.getName().startsWith("set") && !"set".equals(method.getName()); }  static boolean isPrimitives(Class<?> clazz); static String getCodeBase(Class<?> cls); static Method getMethod(String clazzName, String methodName, String[] argsType); static Method getMethod(Class clazz, String methodName, Class... argsType); static Method getPropertySetterMethod(Class clazz, String property, Class propertyClazz); static Method getPropertyGetterMethod(Class clazz, String property);  }
@Test public void testIsBeanPropertyWriteMethod() throws Exception { Assert.assertFalse(isBeanPropertyWriteMethod(null)); Assert.assertTrue(isBeanPropertyWriteMethod(TestReflect.class.getMethod("setS", int.class))); Assert.assertFalse(isBeanPropertyWriteMethod(TestReflect.class.getMethod("set", int.class))); Assert.assertFalse(isBeanPropertyWriteMethod(TestReflect.class.getDeclaredMethod("set1", int.class))); Assert.assertFalse(isBeanPropertyWriteMethod(TestReflect.class.getMethod("set2", int.class))); Assert.assertFalse(isBeanPropertyWriteMethod(TestReflect.class.getMethod("set3", int.class, int.class))); Assert.assertFalse(isBeanPropertyWriteMethod(TestReflect.class.getMethod("aset4", int.class))); }