| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Interface to be implemented by objects that can store and expose information about data binding errors.
Field names can be properties of the given object (e.g. "name" when binding to a customer object), or nested fields in case of subobjects (e.g. "address.street"). Supports subtree navigation via setNestedPath, e.g. an AddressValidator validates "address", not being aware that this is a subobject of customer.
Note: Errors objects are single-threaded.
| Method Summary | |
List | getAllErrors()Get all errors, both global and field ones. |
int | getErrorCount()Return the total number of errors. |
FieldError | getFieldError(String field)Get the first error associated with the given field, if any. |
int | getFieldErrorCount(String field)Return the number of errors associated with the given field. |
List | getFieldErrors(String field)Get all errors associated with the given field. |
Object | getFieldValue(String field)Return the current value of the given field, either the current bean property value or a rejected update from the last binding. |
ObjectError | getGlobalError()Get the first global error, if any. |
int | getGlobalErrorCount()Return the number of global (i.e. |
List | getGlobalErrors()Get all global errors. |
String | getObjectName()Return the name of the bound object. |
boolean | hasErrors()Return if there were any errors. |
boolean | hasFieldErrors(String field)Return if there are any errors associated with the given field. |
boolean | hasGlobalErrors()Return if there were any global (i.e. |
void | reject(String errorCode, String defaultMessage)Reject the current object, using the given error description. |
void | reject(String errorCode, Object[] errorArgs, String defaultMessage)Reject the current object, using the given error description. |
void | rejectValue(String field, String errorCode, String defaultMessage)Reject the given field of the current object, using the given error description. |
void | rejectValue(String field, String errorCode, Object[] errorArgs, String defaultMessage)Reject the given field of the current object, using the given error description. |
void | setNestedPath(String nestedPath)Allow context to be changed so that standard validators can validate subtrees. |
| Method Detail |
public List getAllErrors()
public int getErrorCount()
public FieldError getFieldError(String field)
public int getFieldErrorCount(String field)
public List getFieldErrors(String field)
public Object getFieldValue(String field)
public ObjectError getGlobalError()
public int getGlobalErrorCount()
public List getGlobalErrors()
public String getObjectName()
public boolean hasErrors()
public boolean hasFieldErrors(String field)
public boolean hasGlobalErrors()
public void reject(String errorCode, String defaultMessage)
public void reject(String errorCode, Object[] errorArgs, String defaultMessage)
public void rejectValue(String field, String errorCode, String defaultMessage)
public void rejectValue(String field, String errorCode, Object[] errorArgs, String defaultMessage)
public void setNestedPath(String nestedPath)
For example, an address validator could validate the subobject address of a customer object.
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||