com.ivata.mask.validation
Class ValidationError

java.lang.Object
  extended bycom.ivata.mask.validation.ValidationError
All Implemented Interfaces:
java.io.Serializable

public class ValidationError
extends java.lang.Object
implements java.io.Serializable

This class represents an error which occurred when data is validated for submission.

Before new data is posted to ivata masks , it is possible to validate it. If the data is for any reason invalid, then an instance of this class is created to indicate what is wrong or missing ind the data (invalid date format? missing parameter?). Multiple errors which occur can be grouped together in a ValidationErrors instance.

This class originally appeared as part of ivata op and ivata team portal .

.

Since:
ivata masks 0.4 (2002-11-11)
Version:
$Revision: 1.4 $
Author:
Colin MacLeod colin.macleod@ivata.com
See Also:
ValidationErrors, org.apache.struts.action.ActionError, Serialized Form

Constructor Summary
ValidationError(java.lang.String resourceFieldPathParam, Field fieldParam, java.lang.String errorKeyParam)
           Create a new instance with the given field, and error key.
ValidationError(java.lang.String resourceFieldPathParam, Field fieldParam, java.lang.String errorKeyParam, java.util.List parametersParam)
           Create a new instance with the given field and parameters.
ValidationError(java.lang.String errorKeyParam, java.util.List parametersParam)
           Create a new instance with the given error key and parameters.
ValidationError(java.lang.String resourceFieldPathParam, java.lang.String bundle, Field fieldParam, java.lang.String errorKeyParam)
           Create a new instance with the given field, error key and bundle.
ValidationError(java.lang.String resourceFieldPathParam, java.lang.String bundle, Field fieldParam, java.lang.String errorKeyParam, java.util.List parametersParam)
           Create a new instance with the given bundle, field, label and parameters.
 
Method Summary
 java.lang.String getBundle()
          Get the message resource bundle associated with this error.
 java.lang.String getErrorKey()
           Message key of the error which occurred, from the error message resources.
 Field getField()
           Get the field which contained an invalid value and caused the error.
 java.util.List getParameters()
           A list of error string parameters.
 java.lang.String getResourceFieldPath()
           Get the message resources field path associated with this field.
 java.lang.String toString()
          Overridden from Object for convenience when debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidationError

public ValidationError(java.lang.String errorKeyParam,
                       java.util.List parametersParam)

Create a new instance with the given error key and parameters. Attributes of this class are immutable so the values specified here cannot be later altered.

Parameters:
errorKeyParam - label key of the error which occurred.
parametersParam - list of error string parameters, used to completed the error message. This attribute may be null if there are no parameters required..

ValidationError

public ValidationError(java.lang.String resourceFieldPathParam,
                       Field fieldParam,
                       java.lang.String errorKeyParam)

Create a new instance with the given field, and error key. Attributes of this class are immutable so the values specified here cannot be later altered.

Parameters:
fieldParam - field which contained an invalid value and caused the error.
errorKeyParam - key of the error which occurred.

ValidationError

public ValidationError(java.lang.String resourceFieldPathParam,
                       Field fieldParam,
                       java.lang.String errorKeyParam,
                       java.util.List parametersParam)

Create a new instance with the given field and parameters. Attributes of this class are immutable so the values specified here cannot be later altered.

Parameters:
resourceFieldPathParam - Refer to #getResourceFieldPathParam.
fieldParam - field which contained an invalid value and caused the error.
errorKeyParam - label key of the error which occurred.
parametersParam - list of error string parameters, used to completed the error message. This attribute may be null if there are no parameters required..

ValidationError

public ValidationError(java.lang.String resourceFieldPathParam,
                       java.lang.String bundle,
                       Field fieldParam,
                       java.lang.String errorKeyParam)

Create a new instance with the given field, error key and bundle. Attributes of this class are immutable so the values specified here cannot be later altered.

Parameters:
bundle - Refer to getBundle().
resourceFieldPathParam - Refer to #getResourceFieldPathParam.
fieldParam - field which contained an invalid value and caused the error.
errorKeyParam - key of the error which occurred.

ValidationError

public ValidationError(java.lang.String resourceFieldPathParam,
                       java.lang.String bundle,
                       Field fieldParam,
                       java.lang.String errorKeyParam,
                       java.util.List parametersParam)

Create a new instance with the given bundle, field, label and parameters. Attributes of this class are immutable so the values specified here cannot be later altered.

Parameters:
bundle - Refer to getBundle().
resourceFieldPathParam - Refer to #getResourceFieldPathParam.
fieldParam - field which contained an invalid value and caused the error.
errorKeyParam - label key of the error which occurred.
parametersParam - list of error string parameters. This attribute may be null if there are no parameters required..
Method Detail

getBundle

public java.lang.String getBundle()
Get the message resource bundle associated with this error. May be null.

Returns:
message resource used to localize the field name for this error.

getErrorKey

public final java.lang.String getErrorKey()

Message key of the error which occurred, from the error message resources.

Returns:
message key describing the error.

getField

public final Field getField()

Get the field which contained an invalid value and caused the error.

Returns:
the current value of field.

getParameters

public final java.util.List getParameters()

A list of error string parameters. Depending on the value of key, there may be many parameters describing the error in detail. This attribute may be null if there are no parameters required.

Returns:
the current value of parameters.

getResourceFieldPath

public java.lang.String getResourceFieldPath()

Get the message resources field path associated with this field. This is the first part of the path used to search for string in the localization bundle.

Returns:
message resource field path.

toString

public final java.lang.String toString()
Overridden from Object for convenience when debugging.

Returns:
the class name followed by key, field and parameters.


Copyright © 2001-2005 ivata limited. All Rights Reserved.