com.ca.jcs.validator.core
Class RegexValidator

java.lang.Object
  extended by com.ca.jcs.validator.core.RegexValidator
All Implemented Interfaces:
StringValidator

public class RegexValidator
extends Object
implements StringValidator

Validate single or multiple values stored for an attribute against a regular expression provided in metadata, also an optional description of value set matching the expression can be provided.


Field Summary
static String BRIEF_PREFIX
          When used as the prefix of the validation failure string means the regular expression itself is not put in the failure message (NOT_REGEX_MATCH_BRIEF_MSG is used instead of NOT_REGEX_MATCH_MSG).
static String NOT_REGEX_MATCH_BRIEF_MSG
           
static String NOT_REGEX_MATCH_MSG
           
 
Constructor Summary
RegexValidator(String regex, String regexDescr)
           
RegexValidator(String style, String regex, String regexDescr)
           
 
Method Summary
 ErrorMessages validate(String value)
          Validate the provided value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_REGEX_MATCH_MSG

public static final String NOT_REGEX_MATCH_MSG
See Also:
Constant Field Values

NOT_REGEX_MATCH_BRIEF_MSG

public static final String NOT_REGEX_MATCH_BRIEF_MSG
See Also:
Constant Field Values

BRIEF_PREFIX

public static final String BRIEF_PREFIX
When used as the prefix of the validation failure string means the regular expression itself is not put in the failure message (NOT_REGEX_MATCH_BRIEF_MSG is used instead of NOT_REGEX_MATCH_MSG).

See Also:
Constant Field Values
Constructor Detail

RegexValidator

public RegexValidator(String regex,
                      String regexDescr)

RegexValidator

public RegexValidator(String style,
                      String regex,
                      String regexDescr)
Method Detail

validate

public ErrorMessages validate(String value)
Description copied from interface: StringValidator
Validate the provided value.

Specified by:
validate in interface StringValidator
Parameters:
value - Value to be validated.
Returns:
Null if value has desired format, and otherwise one or more error messages where only their msgFormatId field needs to be set.


Created 2011-07-14 13:27 EST