public class DateConstraints extends Object implements Constraints
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_FORMAT
Default format for date parsing "yyyy-MM-dd/HH:mm:ss"
|
protected DateFormat |
format |
protected Date |
max |
protected Date |
min |
Constructor and Description |
---|
DateConstraints()
Default constructor.
|
DateConstraints(String format,
Locale locale,
String min,
String max)
Creates a date constraints enforcement entity.
|
Modifier and Type | Method and Description |
---|---|
DateFormat |
getFormat()
Get the format for parsing the date/time values.
|
boolean |
isValid(Serializable o)
Determines whether or not the given object is valid in the context of
these constraints.
|
public static final String DEFAULT_FORMAT
protected Date min
protected Date max
protected DateFormat format
public DateConstraints()
public DateConstraints(String format, Locale locale, String min, String max)
format
- date format to be used for validationlocale
- context locale for validationmin
- If not null, it specifies the minimum temporal value the
parsed argument can have to be a valid parameter.max
- If not null, it specifies the maximum temporal value the
parsed argument can have to be a valid parameter.public boolean isValid(Serializable o)
Constraints
isValid
in interface Constraints
o
- object to be validated against the constraintsConstraints.isValid(java.io.Serializable)
public DateFormat getFormat()
Copyright © 2016. All Rights Reserved.