/** * Create a BindStatus for the given bind object, using the * "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will * be resolved (e.g. "person.age") * @param htmlEscape create a BindStatus with automatic HTML escaping? * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path, boolean htmlEscape) throws IllegalStateException { return new BindStatus(this, path, htmlEscape); }
/** * Return the resolved error messages for the field or object, * if any. Returns an empty array instead of null if none. */ public String[] getErrorMessages() { return initErrorMessages(); }
this.objectErrors = this.errors.getGlobalErrors(); this.errorCodes = initErrorCodes(this.objectErrors);
@Override public boolean isError() { return this.bindStatus.isError(); }
@Override public String getDisplayValue() { return this.bindStatus.getDisplayValue(); }
@Override public String getErrorCode() { return this.bindStatus.getErrorCode(); }
@Override public Object getActualValue() { return this.bindStatus.getActualValue(); }
@Override public String[] getErrorCodes() { return this.bindStatus.getErrorCodes(); }
@Override public PropertyEditor getEditor() { return this.bindStatus.getEditor(); }
@Override public PropertyEditor findEditor(final Class<?> valueClass) { return this.bindStatus.findEditor(valueClass); }
this.objectErrors = this.errors.getGlobalErrors(); this.errorCodes = initErrorCodes(this.objectErrors);
@Override public String toString() { StringBuilder sb = new StringBuilder("BindStatus: "); sb.append("expression=[").append(this.expression).append("]; "); sb.append("value=[").append(this.value).append("]"); if (isError()) { sb.append("; errorCodes=").append(Arrays.asList(this.errorCodes)); } return sb.toString(); }
/** * Return the first error message for the field or object, if any. */ public String getErrorMessage() { String[] errorMessages = initErrorMessages(); return (errorMessages.length > 0 ? errorMessages[0] : ""); }
/** * Create a BindStatus for the given bind object using the * "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will * be resolved (e.g. "person.age") * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path) throws IllegalStateException { return new BindStatus(this, path, isDefaultHtmlEscape()); }
/** * Return an error message string, concatenating all messages * separated by the given delimiter. * @param delimiter separator string, e.g. ", " or "<br>" * @return the error message string */ public String getErrorMessagesAsString(String delimiter) { return StringUtils.arrayToDelimitedString(initErrorMessages(), delimiter); }
/** * Create a BindStatus for the given bind object, using the * "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will * be resolved (e.g. "person.age") * @param htmlEscape create a BindStatus with automatic HTML escaping? * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path, boolean htmlEscape) throws IllegalStateException { return new BindStatus(this, path, htmlEscape); }
/** * Return the first error message for the field or object, if any. */ public String getErrorMessage() { initErrorMessages(); return (this.errorMessages.length > 0 ? this.errorMessages[0] : ""); }
/** * Create a BindStatus for the given bind object using the * "defaultHtmlEscape" setting. * @param path the bean and property path for which values and errors will * be resolved (e.g. "person.age") * @return the new BindStatus instance * @throws IllegalStateException if no corresponding Errors object found */ public BindStatus getBindStatus(String path) throws IllegalStateException { return new BindStatus(this, path, isDefaultHtmlEscape()); }
/** * Return the resolved error messages for the field or object, * if any. Returns an empty array instead of null if none. */ public String[] getErrorMessages() { initErrorMessages(); return this.errorMessages; }
/** * Return an error message string, concatenating all messages * separated by the given delimiter. * @param delimiter separator string, e.g. ", " or "<br>" * @return the error message string */ public String getErrorMessagesAsString(String delimiter) { initErrorMessages(); return StringUtils.arrayToDelimitedString(this.errorMessages, delimiter); }