Class Validatable<T>

  • Type Parameters:
    T - type of validatable
    All Implemented Interfaces:
    IValidatable<T>

    public class Validatable<T>
    extends Object
    implements IValidatable<T>
    This implementation of IValidatable is meant to be used outside of Wicket. It allows other parts of the application to utilize IValidators for validation.

    Example:

     class WebService
     {
            public void addUser(String firstName, String lastName)
            {
                    Validatable standin = new Validatable();
                    standin.setValue(firstName);
                    new FirstNameValidator().validate(standin);
                    standing.setValue(lastName);
                    new LastNameValidator().validate(standin);
                    if (!standin.isValid())
                    {
                            // roll your own ValidationException
                            throw new ValidationException(standin.getErrors());
                    }
                    else
                    {
                            // add user here
                    }
            }
     }
     
    Since:
    1.2.6
    Author:
    Igor Vaynberg (ivaynberg)