Class DatePatternConstraint

All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, Constraint

public class DatePatternConstraint extends ValidDataPatternConstraint
DatePatternConstraint constrains a field to only allow dates which are part of the formats defined in the system. Constraining a field all these formats is often not appropriate for fields, and you may want to constrain the input to a subset of the allowed formats in the system. This can be done by setting the allowed formats to this subset (see BasicDatePatternConstraint bean for example)
Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • DatePatternConstraint

      public DatePatternConstraint()
  • Method Details

    • getRegexString

      protected String getRegexString()
      Returns a regex representing all the allowed formats in the system. If allowedFormats is supplied, returns a regex representing only those formats.
      Specified by:
      getRegexString in class ValidDataPatternConstraint
      Returns:
      regular expression
      See Also:
    • getAllowedFormats

      public List<String> getAllowedFormats()
      Returns:
      the allowedFormats
    • setAllowedFormats

      public void setAllowedFormats(List<String> allowedFormats)
      Sets the alloweFormats for this constraint, this must be a subset of the system configured formats for a date - this list should be used for most fields where you are expecting a user to enter a date in a specific format
      Parameters:
      allowedFormats - the allowedFormats to set
    • getValidationMessageParams

      public List<String> getValidationMessageParams()
      Description copied from class: BaseConstraint
      Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of the param
      Overrides:
      getValidationMessageParams in class BaseConstraint
      Returns:
      the validationMessageParams