/** * @return the attribute name from configured resourcebundle the message for: simple name * (FirstLetter lowercase) + "." + property. Example: Class Person and attribute name - * person.name */ public static String getAttributeName(Class clazz, String fieldName) { String property = StringUtils.getLowerFirstLetter(clazz.getSimpleName()) + "." + fieldName; String value = I18N.get(property); // try to find in superclass if ((value == null || value.isEmpty() || value.equals(property)) && clazz.getSuperclass() != null && !clazz.getSuperclass().equals(Object.class)) { return getAttributeName(clazz.getSuperclass(), fieldName); } if (value != null && value.equals(property)) { return new HumaniseCamelCase().humanise(fieldName); } return value; }