/** * Gets a Double minimum validator for checking if number is greater then or equal to the given * minimum value. If that is not the case, an error message will be generated with the key * "MinimumValidator". The message keys that can be used are: * <p> * <ul> * <li>${minimum}: the minimum value</li> * <li>${input}: the input the user gave</li> * <li>${name}: the name of the <code>Component</code> that failed</li> * <li>${label}: the label of the <code>Component</code> - either comes from * <code>FormComponent.labelModel</code> or resource key [form-id].[form-component-id] in that * order</li> * </ul> * * @param minimum * the minimum value * * @return the requested <code>NumberValidator</code> * @deprecated see {@link org.apache.wicket.validation.validator.MinimumValidator} */ @Deprecated public static NumberValidator minimum(double minimum) { return new DoubleMinimumValidator(minimum); }
/** * @see AbstractValidator#onValidate(IValidatable) */ @Override protected void onValidate(IValidatable validatable) { if (((Number)validatable.getValue()).doubleValue() < minimum) { error(validatable); } }
/** * Gets a Double minimum validator for checking if number is greater then or equal to the given * minimum value. If that is not the case, an error message will be generated with the key * "NumberValidator.minimum". The message keys that can be used are: * <p> * <ul> * <li>${minimum}: the minimum value</li> * <li>${input}: the input the user gave</li> * <li>${name}: the name of the <code>Component</code> that failed</li> * <li>${label}: the label of the <code>Component</code> - either comes from * <code>FormComponent.labelModel</code> or resource key [form-id].[form-component-id] in that * order</li> * </ul> * * @param minimum * the minimum value * * @return the requested <code>NumberValidator</code> */ public static NumberValidator minimum(double minimum) { return new DoubleMinimumValidator(minimum); }
/** * @see AbstractValidator#onValidate(IValidatable) */ protected void onValidate(IValidatable validatable) { if (((Number)validatable.getValue()).doubleValue() < minimum) { error(validatable); } }