Example usage for org.apache.wicket.validation ValidationError addKey

List of usage examples for org.apache.wicket.validation ValidationError addKey

Introduction

In this page you can find the example usage for org.apache.wicket.validation ValidationError addKey.

Prototype

public ValidationError addKey(IValidator<?> validator, String variation) 

Source Link

Document

Shortcut for adding a standard message key variation which is the simple name of the validator class followed by a dot and the variation

If the variation is empty only the validator's simple class name is used

Usage

From source file:org.devgateway.toolkit.forms.validators.YearValidator.java

License:Open Source License

@Override
public void validate(final IValidatable<Integer> validatable) {
    if (validatable.getValue() == null) {
        return;//ww  w.ja v  a2 s .co  m
    }

    if (maxCurrentYear && validatable.getValue() > Calendar.getInstance().get(Calendar.YEAR)) {
        ValidationError error = new ValidationError();
        error.addKey(this, "maxCurrentYear");
        validatable.error(error);
    }
}