com.uwyn.rife.site
Class ValidationError

java.lang.Object
  extended by com.uwyn.rife.site.ValidationError
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ValidationError.INCOMPLETE, ValidationError.INVALID, ValidationError.MANDATORY, ValidationError.NOTNUMERIC, ValidationError.NOTSAMEAS, ValidationError.UNEXPECTED, ValidationError.UNICITY, ValidationError.WRONGFORMAT, ValidationError.WRONGLENGTH

public abstract class ValidationError
extends Object
implements Cloneable

Instances of this class detail subjects that were found invalid during validation.

Each ValidationError is tied to a specific subject and provides more information through an explicative textual identifier.

A collection of commonly used identifiers and implementations are provided as static member variables and static inner classes.

Since:
1.0
Version:
$Revision: 3634 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)
See Also:
Validated

Nested Class Summary
static class ValidationError.INCOMPLETE
           
static class ValidationError.INVALID
           
static class ValidationError.MANDATORY
           
static class ValidationError.NOTNUMERIC
           
static class ValidationError.NOTSAMEAS
           
static class ValidationError.UNEXPECTED
           
static class ValidationError.UNICITY
           
static class ValidationError.WRONGFORMAT
           
static class ValidationError.WRONGLENGTH
           
 
Field Summary
static String IDENTIFIER_INCOMPLETE
           
static String IDENTIFIER_INVALID
           
static String IDENTIFIER_MANDATORY
           
static String IDENTIFIER_NOTNUMERIC
           
static String IDENTIFIER_NOTSAME
           
static String IDENTIFIER_UNEXPECTED
           
static String IDENTIFIER_UNICITY
           
static String IDENTIFIER_WRONGFORMAT
           
static String IDENTIFIER_WRONGLENGTH
           
 
Constructor Summary
ValidationError(String identifier, String subject)
          Creates a new ValidationError instance for the specified identifier and subject.
ValidationError(String identifier, String subject, boolean overridable)
          Creates a new ValidationError instance for the specified identifier and subject.
 
Method Summary
 Object clone()
           
 boolean equals(Object object)
           
 ValidationError erroneousValue(Object erroneousValue)
          Chainable setter to make validation error construction easier
 Object getErroneousValue()
          Returns the erroneous value that caused the validation error, if it's present.
 String getIdentifier()
          Returns the textual identifier that categorizes this validation error.
 String getSubject()
          Returns the erroneous subject name of this validation error.
 int hashCode()
           
 boolean isOverridable()
          Returns wether this error is overridable for the same subject.
 void setErroneousValue(Object erroneousValue)
          Stores the erroneous value that caused the validation error.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTIFIER_MANDATORY

public static final String IDENTIFIER_MANDATORY
See Also:
Constant Field Values

IDENTIFIER_UNICITY

public static final String IDENTIFIER_UNICITY
See Also:
Constant Field Values

IDENTIFIER_WRONGLENGTH

public static final String IDENTIFIER_WRONGLENGTH
See Also:
Constant Field Values

IDENTIFIER_WRONGFORMAT

public static final String IDENTIFIER_WRONGFORMAT
See Also:
Constant Field Values

IDENTIFIER_NOTNUMERIC

public static final String IDENTIFIER_NOTNUMERIC
See Also:
Constant Field Values

IDENTIFIER_UNEXPECTED

public static final String IDENTIFIER_UNEXPECTED
See Also:
Constant Field Values

IDENTIFIER_INCOMPLETE

public static final String IDENTIFIER_INCOMPLETE
See Also:
Constant Field Values

IDENTIFIER_INVALID

public static final String IDENTIFIER_INVALID
See Also:
Constant Field Values

IDENTIFIER_NOTSAME

public static final String IDENTIFIER_NOTSAME
See Also:
Constant Field Values
Constructor Detail

ValidationError

public ValidationError(String identifier,
                       String subject)
Creates a new ValidationError instance for the specified identifier and subject.

The error will not be automatic overridable.

Parameters:
identifier - a non-null String with the textual error identifier
subject - a non-null String with the name of the erroneous subject
Since:
1.0

ValidationError

public ValidationError(String identifier,
                       String subject,
                       boolean overridable)
Creates a new ValidationError instance for the specified identifier and subject.

Parameters:
identifier - a non-null String with the textual error identifier
subject - a non-null String with the name of the erroneous subject
overridable - true to make any other error for the same subject override this error, false if this error should always be shown
Since:
1.5
Method Detail

getIdentifier

public final String getIdentifier()
Returns the textual identifier that categorizes this validation error.

Since:
1.0

getSubject

public final String getSubject()
Returns the erroneous subject name of this validation error.

Since:
1.0

isOverridable

public final boolean isOverridable()
Returns wether this error is overridable for the same subject.

Since:
1.5

setErroneousValue

public void setErroneousValue(Object erroneousValue)
Stores the erroneous value that caused the validation error. This is optional and should only be done when the erroneous value gives more information from the context in which the validation error occurred.

Since:
1.0

erroneousValue

public ValidationError erroneousValue(Object erroneousValue)
Chainable setter to make validation error construction easier

Since:
1.0
See Also:
setErroneousValue(java.lang.Object)

getErroneousValue

public Object getErroneousValue()
Returns the erroneous value that caused the validation error, if it's present.

Since:
1.0

clone

public Object clone()
Overrides:
clone in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.