org.formproc.validation
Class ValidationResultMap

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--org.formproc.validation.ValidationResultMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ValidationResultMap
extends java.util.HashMap

A map of field names to validation results.

Author:
Anthony Eden
See Also:
Serialized Form

Constructor Summary
ValidationResultMap()
           
 
Method Summary
 boolean allValid()
          Return true if all validation results in the map are valid.
 java.lang.String getErrorMessage(java.lang.String field)
          Get the error message for the given field or null if the field is valid.
 java.lang.String getErrorMessage(java.lang.String field, java.util.Locale locale)
          Get the locale-specific error message for the given field or null if the field is valid.
 java.util.Iterator getErrorMessages()
          Get an iterator for all error messages using the default Locale.
 java.util.Iterator getErrorMessages(java.util.Locale locale)
          Get an Iterator for all error messages in the given Locale.
 boolean isValid(java.lang.String field)
          Return true if the given field's validation result is true.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ValidationResultMap

public ValidationResultMap()
Method Detail

allValid

public boolean allValid()
Return true if all validation results in the map are valid.

Returns:
True if all results valid

isValid

public boolean isValid(java.lang.String field)
Return true if the given field's validation result is true. If the field is not found in the map then this method will return true.

Parameters:
field - The field name
Returns:
True if the field is valid

getErrorMessage

public java.lang.String getErrorMessage(java.lang.String field)
Get the error message for the given field or null if the field is valid.

Parameters:
field - The field name
Returns:
The error message

getErrorMessage

public java.lang.String getErrorMessage(java.lang.String field,
                                        java.util.Locale locale)
Get the locale-specific error message for the given field or null if the field is valid.

Parameters:
field - The field name
locale - The Locale
Returns:
The error message

getErrorMessages

public java.util.Iterator getErrorMessages()
Get an iterator for all error messages using the default Locale.

Returns:
An iterator of error messages

getErrorMessages

public java.util.Iterator getErrorMessages(java.util.Locale locale)
Get an Iterator for all error messages in the given Locale.

Parameters:
locale - The Locale
Returns:
An Iterator of error messages


Copyright (c) 2001-2003 Anthony Eden. All Rights Reserved.