com.opensymphony.xwork2
Interface ValidationAware

All Known Subinterfaces:
ValidatorContext
All Known Implementing Classes:
ActionSupport, DelegatingValidatorContext, ValidationAwareSupport, VisitorFieldValidator.AppendingValidatorContext

public interface ValidationAware

ValidationAware classes can accept Action (class level) or field level error messages. Action level messages are kept in a Collection. Field level error messages are kept in a Map from String field name to a List of field error msgs.

Author:
plightbo

Method Summary
 void addActionError(java.lang.String anErrorMessage)
          Add an Action-level error message to this Action.
 void addActionMessage(java.lang.String aMessage)
          Add an Action-level message to this Action.
 void addFieldError(java.lang.String fieldName, java.lang.String errorMessage)
          Add an error message for a given field.
 java.util.Collection<java.lang.String> getActionErrors()
          Get the Collection of Action-level error messages for this action.
 java.util.Collection<java.lang.String> getActionMessages()
          Get the Collection of Action-level messages for this action.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getFieldErrors()
          Get the field specific errors associated with this action.
 boolean hasActionErrors()
          Check whether there are any Action-level error messages.
 boolean hasActionMessages()
          Checks whether there are any Action-level messages.
 boolean hasErrors()
          Checks whether there are any action errors or field errors.
 boolean hasFieldErrors()
          Check whether there are any field errors associated with this action.
 void setActionErrors(java.util.Collection<java.lang.String> errorMessages)
          Set the Collection of Action-level String error messages.
 void setActionMessages(java.util.Collection<java.lang.String> messages)
          Set the Collection of Action-level String messages (not errors).
 void setFieldErrors(java.util.Map<java.lang.String,java.util.List<java.lang.String>> errorMap)
          Set the field error map of fieldname (String) to Collection of String error messages.
 

Method Detail

setActionErrors

void setActionErrors(java.util.Collection<java.lang.String> errorMessages)
Set the Collection of Action-level String error messages.

Parameters:
errorMessages - Collection of String error messages

getActionErrors

java.util.Collection<java.lang.String> getActionErrors()
Get the Collection of Action-level error messages for this action. Error messages should not be added directly here, as implementations are free to return a new Collection or an Unmodifiable Collection.

Returns:
Collection of String error messages

setActionMessages

void setActionMessages(java.util.Collection<java.lang.String> messages)
Set the Collection of Action-level String messages (not errors).

Parameters:
messages - Collection of String messages (not errors).

getActionMessages

java.util.Collection<java.lang.String> getActionMessages()
Get the Collection of Action-level messages for this action. Messages should not be added directly here, as implementations are free to return a new Collection or an Unmodifiable Collection.

Returns:
Collection of String messages

setFieldErrors

void setFieldErrors(java.util.Map<java.lang.String,java.util.List<java.lang.String>> errorMap)
Set the field error map of fieldname (String) to Collection of String error messages.

Parameters:
errorMap - field error map

getFieldErrors

java.util.Map<java.lang.String,java.util.List<java.lang.String>> getFieldErrors()
Get the field specific errors associated with this action. Error messages should not be added directly here, as implementations are free to return a new Collection or an Unmodifiable Collection.

Returns:
Map with errors mapped from fieldname (String) to Collection of String error messages

addActionError

void addActionError(java.lang.String anErrorMessage)
Add an Action-level error message to this Action.

Parameters:
anErrorMessage - the error message

addActionMessage

void addActionMessage(java.lang.String aMessage)
Add an Action-level message to this Action.

Parameters:
aMessage - the message

addFieldError

void addFieldError(java.lang.String fieldName,
                   java.lang.String errorMessage)
Add an error message for a given field.

Parameters:
fieldName - name of field
errorMessage - the error message

hasActionErrors

boolean hasActionErrors()
Check whether there are any Action-level error messages.

Returns:
true if any Action-level error messages have been registered

hasActionMessages

boolean hasActionMessages()
Checks whether there are any Action-level messages.

Returns:
true if any Action-level messages have been registered

hasErrors

boolean hasErrors()
Checks whether there are any action errors or field errors.

Note: that this does not have the same meaning as in WW 1.x.

Returns:
(hasActionErrors() || hasFieldErrors())

hasFieldErrors

boolean hasFieldErrors()
Check whether there are any field errors associated with this action.

Returns:
whether there are any field errors


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.