PropertyUtils { private static String getPropertyName(List<String> tokens, int from, int to) { final StringBuilder builder = new StringBuilder(); for (int i = from; i < to; i++) { builder.append(tokens.get(i)); } return StringUtils.uncapitalize(builder.toString()); } private  PropertyUtils(); static Object getPropertyValue(Object context, String property); static Object setPropertyValue(Object context, String property, Object value); static PropertyDescriptor getPropertyDescriptor(Class<?> domainType, String expression); static Class<?> getTypeOf(Class<?> type); static String getPropertyName(Method getter);  }
@Test public void testPropertyNameFromGetterMethod() { assertThat(PropertyUtils.getPropertyName( Objects.requireNonNull(ReflectionUtils.findMethod(Person.class, "getAddress"))), is("address")); assertThat(PropertyUtils.getPropertyName( Objects.requireNonNull(ReflectionUtils.findMethod(Person.class, "getAddressZip"))), is("addressZip")); }