public String[] resolveMessageCodes(String errorCode, String objectName) { return new String[] { postProcessMessageCode(objectName + CODE_SEPARATOR + errorCode), postProcessMessageCode(errorCode) }; }
/** * Build the code list for the given code and field: an object/field-specific code, a field-specific code, a plain * error code. * <p> * Arrays, Lists and Maps are resolved both for specific elements and the whole collection. * <p> * See the {@link DefaultMessageCodesResolver class level Javadoc} for details on the generated codes. * @return the list of codes */ public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class<?> fieldType) { List<String> codeList = new ArrayList<>(); List<String> fieldList = new ArrayList<>(); buildFieldList(field, fieldList); for (String fieldInList : fieldList) { codeList.add(postProcessMessageCode(objectName + CODE_SEPARATOR + fieldInList + CODE_SEPARATOR + errorCode)); } int dotIndex = field.lastIndexOf('.'); if (dotIndex != -1) { buildFieldList(field.substring(dotIndex + 1), fieldList); } for (String fieldInList : fieldList) { codeList.add(postProcessMessageCode(fieldInList + CODE_SEPARATOR + errorCode)); } if (fieldType != null) { codeList.add(postProcessMessageCode(fieldType.getName() + CODE_SEPARATOR + errorCode)); } codeList.add(postProcessMessageCode(errorCode)); return StringUtils.toStringArray(codeList); }
public String[] resolveMessageCodes(String errorCode, String objectName) { return new String[] { postProcessMessageCode(objectName + CODE_SEPARATOR + errorCode), postProcessMessageCode(errorCode) }; }
/** * Build the code list for the given code and field: an object/field-specific code, a field-specific code, a plain * error code. * <p> * Arrays, Lists and Maps are resolved both for specific elements and the whole collection. * <p> * See the {@link DefaultMessageCodesResolver class level Javadoc} for details on the generated codes. * @return the list of codes */ public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class<?> fieldType) { List<String> codeList = new ArrayList<>(); List<String> fieldList = new ArrayList<>(); buildFieldList(field, fieldList); for (String fieldInList : fieldList) { codeList.add(postProcessMessageCode(objectName + CODE_SEPARATOR + fieldInList + CODE_SEPARATOR + errorCode)); } int dotIndex = field.lastIndexOf('.'); if (dotIndex != -1) { buildFieldList(field.substring(dotIndex + 1), fieldList); } for (String fieldInList : fieldList) { codeList.add(postProcessMessageCode(fieldInList + CODE_SEPARATOR + errorCode)); } if (fieldType != null) { codeList.add(postProcessMessageCode(fieldType.getName() + CODE_SEPARATOR + errorCode)); } codeList.add(postProcessMessageCode(errorCode)); return StringUtils.toStringArray(codeList); }