public class DateValidator extends RangeValidator<Date>
null
they are not checked.
Resource keys:
DateValidator.exact
if min==maxDateValidator.range
if both min and max are not null
DateValidator.minimum
if max is null
DateValidator.maximum
if min is null
Error Message Variables:
name
: the id of Component
that failedlabel
: the label of the Component
(either comes from
FormComponent.labelModel
or resource key <form-id>.<form-component-id>
input
: the input valueinputdate
: the formatted input valueminimum
: the minimum allowed valuemaximum
: the maximum allowed valueAbstractRangeValidator.Mode
Modifier | Constructor and Description |
---|---|
protected |
DateValidator()
Constructor used for subclasses who want to set the range using
AbstractRangeValidator.setRange(Comparable, Comparable) |
|
DateValidator(Date minimum,
Date maximum)
Constructor that sets the minimum and maximum date values.
|
|
DateValidator(Date minimum,
Date maximum,
String format)
Constructor that sets the minimum and maximum date values and a custom date formating.
|
Modifier and Type | Method and Description |
---|---|
protected IValidationError |
decorate(IValidationError error,
IValidatable<Date> validatable)
Allows subclasses to decorate reported errors
|
static DateValidator |
maximum(Date maximum) |
static DateValidator |
maximum(Date maximum,
String format) |
static DateValidator |
minimum(Date minimum) |
static DateValidator |
minimum(Date minimum,
String format) |
static DateValidator |
range(Date minimum,
Date maximum) |
static DateValidator |
range(Date minimum,
Date maximum,
String format) |
getValue
getMaximum, getMinimum, getMode, setRange, validate
afterRender, beforeRender, bind, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, onRemove, renderHead, unbind
public DateValidator(Date minimum, Date maximum, String format)
minimum
- the minimum datemaximum
- the maximum dateformat
- The format string used to format the date with SimpleDateFormatpublic DateValidator(Date minimum, Date maximum)
minimum
- the minimum datemaximum
- the maximum dateprotected DateValidator()
AbstractRangeValidator.setRange(Comparable, Comparable)
public static DateValidator range(Date minimum, Date maximum)
minimum
- the minimum Date
maximum
- the maximum Date
DateValidator
that validates if a date is between (inclusive) a minimum and
maximumpublic static DateValidator range(Date minimum, Date maximum, String format)
minimum
- the minimum Date
maximum
- the maximum Date
format
- The format string used to format the date with SimpleDateFormatDateValidator
that validates if a date is between (inclusive) a minimum and
maximumpublic static DateValidator minimum(Date minimum)
minimum
- the minimum Date
DateValidator
that validates if a date is after or equal to a minimum datepublic static DateValidator minimum(Date minimum, String format)
minimum
- the minimum Date
format
- The format string used to format the date with SimpleDateFormatDateValidator
that validates if a date is after or equal to a minimum datepublic static DateValidator maximum(Date maximum)
maximum
- the maximum Date
DateValidator
that validates if a date is before or equal to a maximum datepublic static DateValidator maximum(Date maximum, String format)
maximum
- the maximum Date
format
- The format string used to format the date with SimpleDateFormatDateValidator
that validates if a date is before or equal to a maximum dateprotected IValidationError decorate(IValidationError error, IValidatable<Date> validatable)
AbstractRangeValidator
decorate
in class AbstractRangeValidator<Date,Date>
Copyright © 2006–2016 Apache Software Foundation. All rights reserved.