org.jsxp.framework
Class Validator

java.lang.Object
  extended by org.jsxp.framework.Validator

public class Validator
extends java.lang.Object

The Class Validator. You need it, if you use the jsxp frameworks basic validation features to validate input parameter. You can create a Validator-instance anywhere. Use the ViewController.createValidator() method. The standard way is to use it in your ViewController.validate() method.

See Also:
ValidationError

Field Summary
protected static java.lang.String VALIDATION_ERROR_LIST
          The Constant VALIDATION_ERROR_LIST.
 
Constructor Summary
Validator(ViewController ViewController)
          Instantiates a new validator.
 
Method Summary
 void addValidationError(java.lang.String message, ElementProcessor... elementProcessors)
          Adds the validation error.
 boolean hasErrors()
          Checks for errors.
 void validate(boolean condition, java.lang.String message, ElementProcessor... elementProcessors)
          Validates a condition and add an validation error in one step
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_ERROR_LIST

protected static final java.lang.String VALIDATION_ERROR_LIST
The Constant VALIDATION_ERROR_LIST.

See Also:
Constant Field Values
Constructor Detail

Validator

public Validator(ViewController ViewController)
Instantiates a new validator.

Parameters:
ViewController - the view controller
Method Detail

addValidationError

public void addValidationError(java.lang.String message,
                               ElementProcessor... elementProcessors)
Adds the validation error. If you add an error to the validator, the corresponding view controller will not be executed by calling ViewController.skipExecution(). Also the the ViewController will be redirected to Context.getLastView(). And the method Context.saveInputToRestoreLater() will be called, so that the next view controller can get the input parameters even after a redirect by implementing ViewController.getPreviousInputParameterBean().

Parameters:
message -
elementProcessors -

hasErrors

public boolean hasErrors()
Checks for errors.

Returns:
true, if successful

validate

public void validate(boolean condition,
                     java.lang.String message,
                     ElementProcessor... elementProcessors)
Validates a condition and add an validation error in one step

Parameters:
condition -
message -
elementProcessors -


Copyright © 2012 Oliver Szymanski & David Tanzer