ReflectUtils { protected static String getPropertyNameFromBeanReadMethod(Method method) { if (isBeanPropertyReadMethod(method)) { if (method.getName().startsWith("get")) { return method.getName().substring(3, 4).toLowerCase() + method.getName().substring(4); } if (method.getName().startsWith("is")) { return method.getName().substring(2, 3).toLowerCase() + method.getName().substring(3); } } return null; }  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 testGetPropertyNameFromBeanReadMethod() throws Exception { Method method = TestReflect.class.getMethod("getS"); Assert.assertEquals("s", getPropertyNameFromBeanReadMethod(method)); method = TestReflect.class.getMethod("getName"); Assert.assertEquals("name", getPropertyNameFromBeanReadMethod(method)); method = TestReflect.class.getMethod("isB"); Assert.assertEquals("b", getPropertyNameFromBeanReadMethod(method)); method = TestReflect.class.getMethod("is"); Assert.assertNull(getPropertyNameFromBeanReadMethod(method)); }