Package org.apache.tapestry5
Class ValidationTrackerImpl
- java.lang.Object
-
- org.apache.tapestry5.BaseOptimizedSessionPersistedObject
-
- org.apache.tapestry5.ValidationTrackerImpl
-
- All Implemented Interfaces:
Serializable
,OptimizedSessionPersistedObject
,ValidationTracker
public final class ValidationTrackerImpl extends BaseOptimizedSessionPersistedObject implements ValidationTracker, Serializable
Standard implementation ofValidationTracker
. Works pretty hard to ensure a minimum amount of data is stored in the HttpSession.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ValidationTrackerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all information stored by the tracker.String
getError(Field field)
Returns a previously recorded error message.List<String>
getErrors()
Returns a list of all error messages.boolean
getHasErrors()
Returns true if any field contains an error.String
getInput(Field field)
Returns a previously recorded input value.List<String>
getUnassociatedErrors()
Returns just the errors that are not associated with any fields.boolean
inError(Field field)
For a given field, determines if the field is "in error", meaning that an error message has been previously recorded for the field.void
recordError(String errorMessage)
Records an error message that is not associated with any specific field.void
recordError(Field field, String errorMessage)
Records an error message for a field.void
recordInput(Field field, String input)
Called by a field to record the exact input from the user, prior to any validation.-
Methods inherited from class org.apache.tapestry5.BaseOptimizedSessionPersistedObject
checkAndResetDirtyMarker, markDirty
-
-
-
-
Constructor Detail
-
ValidationTrackerImpl
public ValidationTrackerImpl()
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:ValidationTracker
Clears all information stored by the tracker.- Specified by:
clear
in interfaceValidationTracker
-
getError
public String getError(Field field)
Description copied from interface:ValidationTracker
Returns a previously recorded error message.- Specified by:
getError
in interfaceValidationTracker
-
getErrors
public List<String> getErrors()
Description copied from interface:ValidationTracker
Returns a list of all error messages. The messages are stored in the order that they were added to the tracker, except that unassociated errors (unassociated with any field) are listed first.- Specified by:
getErrors
in interfaceValidationTracker
-
getUnassociatedErrors
public List<String> getUnassociatedErrors()
Description copied from interface:ValidationTracker
Returns just the errors that are not associated with any fields.- Specified by:
getUnassociatedErrors
in interfaceValidationTracker
-
getHasErrors
public boolean getHasErrors()
Description copied from interface:ValidationTracker
Returns true if any field contains an error.- Specified by:
getHasErrors
in interfaceValidationTracker
-
getInput
public String getInput(Field field)
Description copied from interface:ValidationTracker
Returns a previously recorded input value.- Specified by:
getInput
in interfaceValidationTracker
-
inError
public boolean inError(Field field)
Description copied from interface:ValidationTracker
For a given field, determines if the field is "in error", meaning that an error message has been previously recorded for the field.- Specified by:
inError
in interfaceValidationTracker
- Returns:
- true if an error message is present
-
recordError
public void recordError(Field field, String errorMessage)
Description copied from interface:ValidationTracker
Records an error message for a field. The error message is primarily derived from aValidationException
thrown by aValidator
orTranslator
.- Specified by:
recordError
in interfaceValidationTracker
-
recordError
public void recordError(String errorMessage)
Description copied from interface:ValidationTracker
Records an error message that is not associated with any specific field. This often reflects some amount of cross-form validation.- Specified by:
recordError
in interfaceValidationTracker
-
recordInput
public void recordInput(Field field, String input)
Description copied from interface:ValidationTracker
Called by a field to record the exact input from the user, prior to any validation. If the form is redisplayed (to present errors), the input value will be sent back to the user for correction.- Specified by:
recordInput
in interfaceValidationTracker
- Parameters:
field
- the field recording the inputinput
- the value obtained from the forms submission
-
-