|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fulcrum.intake.validator.DefaultValidator
org.apache.fulcrum.intake.validator.DateStringValidator
public class DateStringValidator
Validates numbers with the following constraints in addition to those listed in DefaultValidator.
Name | Valid Values | Default Value |
---|---|---|
format | see SimpleDateFormat javadoc | |
formatx | see SimpleDateFormat javadoc | |
where x is >= 1 to specify multiple date formats. Only one format rule should have a message | ||
flexible | true, as long as DateFormat can parse the date, allow it, and false | false |
Field Summary |
---|
Fields inherited from class org.apache.fulcrum.intake.validator.DefaultValidator |
---|
errorMessage, log, maxLength, maxLengthMessage, minLength, minLengthMessage, required, requiredMessage |
Fields inherited from interface org.apache.fulcrum.intake.validator.Validator |
---|
FLEXIBLE_RULE_NAME, FORMAT_RULE_NAME, INVALID_NUMBER_RULE_NAME, MASK_RULE_NAME, MAX_LENGTH_RULE_NAME, MAX_VALUE_RULE_NAME, MIN_LENGTH_RULE_NAME, MIN_VALUE_RULE_NAME, REQUIRED_RULE_NAME |
Constructor Summary | |
---|---|
DateStringValidator()
Default Constructor |
|
DateStringValidator(Map paramMap)
|
Method Summary | |
---|---|
void |
assertValidity(String testValue)
Determine whether a testValue meets the criteria specified in the constraints defined for this validator |
String |
format(Date date)
Formats a date into a String. |
String |
getDateFormatMessage()
Get the value of minLengthMessage. |
List |
getDateFormats()
Get the value of dateFormats. |
void |
init(Map paramMap)
Constructor to use when initialising Object |
boolean |
isFlexible()
Get the value of flexible. |
Date |
parse(String s)
Parses the String s according to the rules/formats for this validator. |
void |
setDateFormatMessage(String message)
Only sets the message if the new message has some information. |
void |
setDateFormats(List formats)
Set the value of dateFormats. |
void |
setFlexible(boolean flexible)
Set the value of flexible. |
Methods inherited from class org.apache.fulcrum.intake.validator.DefaultValidator |
---|
assertValidity, getMaxLength, getMaxLengthMessage, getMessage, getMinLength, getMinLengthMessage, getRequiredMessage, isRequired, isValid, isValid, setMaxLength, setMaxLengthMessage, setMinLength, setMinLengthMessage, setRequired, setRequiredMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateStringValidator(Map paramMap) throws IntakeException
IntakeException
public DateStringValidator()
Method Detail |
---|
public void init(Map paramMap) throws InvalidMaskException
init
in interface InitableByConstraintMap
init
in class DefaultValidator
paramMap
-
InvalidMaskException
public void assertValidity(String testValue) throws ValidationException
assertValidity
in interface Validator
assertValidity
in class DefaultValidator
testValue
- a String
to be tested
ValidationException
- containing an error message if the
testValue did not pass the validation tests.public Date parse(String s) throws ParseException
ParseException
- indicates that the string could not be
parsed into a date.public String format(Date date)
date
- the Date object to convert into a string.
public String getDateFormatMessage()
public void setDateFormatMessage(String message)
message
- Value to assign to minLengthMessage.public List getDateFormats()
public void setDateFormats(List formats)
formats
- Value to assign to dateFormats.public boolean isFlexible()
public void setFlexible(boolean flexible)
flexible
- Value to assign to flexible.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |