|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.finalist.util.ejb.validation.ModelErrors
A class that encapsulates the error messages being reported by
the validate()
method of an ActionForm
.
Validation errors are either global to the entire ActionForm
bean they are associated with, or they are specific to a particular
bean property (and, therefore, a particular input field on the corresponding
form).
Each individual error is described by an ModelError
object, which contains a message key (to be looked up in an appropriate
message resources database), and up to four placeholder arguments used for
parametric substitution in the resulting message.
IMPLEMENTATION NOTE - It is assumed that these objects are created and manipulated only within the context of a single thread. Therefore, no synchronization is required for access to internal collections.
Field Summary | |
protected java.util.HashMap |
errors
The accumulated set of ModelError objects (represented
as an ArrayList) for each property, keyed by property name. |
static java.lang.String |
GLOBAL_ERROR
"Property" name to store global error under... |
Constructor Summary | |
ModelErrors()
|
Method Summary | |
void |
add(java.lang.String property,
ModelError error)
Add an error message to the set of errors for the specified property. |
void |
addGenericError(ModelError error)
Add an error message to the set of errors for the specified property. |
void |
clear()
Clear all error messages recorded by this object. |
boolean |
empty()
Return true if there are no error messages recorded
in this collection, or false otherwise. |
java.util.Iterator |
get()
Return the set of all recorded error messages, without distinction by which property the messages are associated with. |
java.util.Iterator |
get(java.lang.String property)
Return the set of error messages related to a specific property. |
java.util.Iterator |
properties()
Return the set of property names for which at least one error has been recorded. |
int |
size()
Return the number of errors recorded for all properties (including global errors). |
int |
size(java.lang.String property)
Return the number of errors associated with the specified property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String GLOBAL_ERROR
protected java.util.HashMap errors
ModelError
objects (represented
as an ArrayList) for each property, keyed by property name.
Constructor Detail |
public ModelErrors()
Method Detail |
public void add(java.lang.String property, ModelError error)
property
- Property name (or 4.GLOBAL_ERROR)error
- The error message to be addedpublic void addGenericError(ModelError error)
error
- The error message to be addedpublic void clear()
public boolean empty()
true
if there are no error messages recorded
in this collection, or false
otherwise.
public java.util.Iterator get()
public java.util.Iterator get(java.lang.String property)
property
- Property name (or ModelErrors.GLOBAL_ERROR)public java.util.Iterator properties()
ModelErrors.GLOBAL_ERROR
will be one of the returned
property names.
public int size()
empty()
if all you care about is whether or not there are
any error messages at all.
public int size(java.lang.String property)
property
- Property name (or ModelErrors.GLOBAL_ERROR)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |