com.scooterframework.common.validation
Class ValidationResults

java.lang.Object
  extended by com.scooterframework.common.validation.ValidationResults
All Implemented Interfaces:
java.io.Serializable

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

ValidationResults class contains results of validations.

See Also:
Serialized Form

Constructor Summary
ValidationResults()
           
 
Method Summary
 void clear()
          Clears all errors.
 int count()
          Returns number of errors.
 boolean failed()
          Checks the end result of a validation process
 java.util.List<Message> getErrorMessages()
          Gets error messages of validation
 java.util.List<Message> getErrorsOn(java.lang.String key)
          Returns a list of errors on a specific key (column).
 java.lang.String[] getFullMessages()
          Returns a string array of all the contents of error messages.
 java.lang.String[] getFullMessagesOn(java.lang.String key)
          Returns a string array of all the contents of error messages on a specific key (column).
 boolean hasErrorOn(java.lang.String key)
          Checks if there are errors associated with a specific key.
 void recordValidationException(Message validationMessage)
          Records a validation error message
 void recordValidationException(java.lang.String messageKey)
          Records a validation error message
 void recordValidationException(java.lang.String key, java.lang.String messageKey)
          Records a validation error message for a key or a field
 void recordValidationException(java.lang.String key, java.lang.String messageKey, java.lang.Object value)
          Records a validation error message for a key or a field
 void recordValidationException(java.lang.String key, java.lang.String messageKey, java.lang.Object[] values)
          Records a validation error message for a key or a field
 void recordValidationException(java.lang.String key, java.lang.String messageKey, java.lang.Object value0, java.lang.Object value1)
          Records a validation error message for a key or a field
 void recordValidationException(java.lang.String key, java.lang.String messageKey, java.lang.Object value0, java.lang.Object value1, java.lang.Object value2)
          Records a validation error message for a key or a field
 int size()
          Returns number of errors.
 java.lang.String toString()
          Returns a string representation of this object.
 java.lang.String toXML()
          Returns a xml representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidationResults

public ValidationResults()
Method Detail

recordValidationException

public void recordValidationException(java.lang.String messageKey)
Records a validation error message

Parameters:
messageKey - error message key or error message

recordValidationException

public void recordValidationException(java.lang.String key,
                                      java.lang.String messageKey)
Records a validation error message for a key or a field

Parameters:
key - String key or field
messageKey - error message key or error message

recordValidationException

public void recordValidationException(java.lang.String key,
                                      java.lang.String messageKey,
                                      java.lang.Object value)
Records a validation error message for a key or a field

Parameters:
key - String key or field
messageKey - error message key or error message
value - a value that can be used in the message

recordValidationException

public void recordValidationException(java.lang.String key,
                                      java.lang.String messageKey,
                                      java.lang.Object value0,
                                      java.lang.Object value1)
Records a validation error message for a key or a field

Parameters:
key - String key or field
messageKey - error message key or error message
value0 - a value that can be used in the message
value1 - a value that can be used in the message

recordValidationException

public void recordValidationException(java.lang.String key,
                                      java.lang.String messageKey,
                                      java.lang.Object value0,
                                      java.lang.Object value1,
                                      java.lang.Object value2)
Records a validation error message for a key or a field

Parameters:
key - String key or field
messageKey - error message key or error message
value0 - a value that can be used in the message
value1 - a value that can be used in the message
value2 - a value that can be used in the message

recordValidationException

public void recordValidationException(java.lang.String key,
                                      java.lang.String messageKey,
                                      java.lang.Object[] values)
Records a validation error message for a key or a field

Parameters:
key - String key or field
messageKey - error message key or error message
values - an array of values that can be used in the message

recordValidationException

public void recordValidationException(Message validationMessage)
Records a validation error message

Parameters:
validationMessage - a generic validation message

failed

public boolean failed()
Checks the end result of a validation process

Returns:
boolean True if there is no validation failure

clear

public void clear()
Clears all errors.


getErrorMessages

public java.util.List<Message> getErrorMessages()
Gets error messages of validation

Returns:
Vector errorMessageList

count

public int count()
Returns number of errors.

Returns:
int number of errors.

size

public int size()
Returns number of errors.

Returns:
int number of errors.

getFullMessages

public java.lang.String[] getFullMessages()
Returns a string array of all the contents of error messages.

Returns:
a string array

getFullMessagesOn

public java.lang.String[] getFullMessagesOn(java.lang.String key)
Returns a string array of all the contents of error messages on a specific key (column).

Returns:
a string array

getErrorsOn

public java.util.List<Message> getErrorsOn(java.lang.String key)
Returns a list of errors on a specific key (column). Each item in the list is an ExpandedMessage instance.

Parameters:
key - a key to an error, usually is a column name
Returns:
list of errors

hasErrorOn

public boolean hasErrorOn(java.lang.String key)
Checks if there are errors associated with a specific key.

Parameters:
key - a key to an error, usually is a column name
Returns:
if there are errors associated with the key.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
String

toXML

public java.lang.String toXML()
Returns a xml representation of this object.
 Example:
      
      
        Age must be within range of 0 and 5.
        Name must be unique.
      
 

Returns:
String