toolbox.web.validation
Class RegexField

Package class diagram package RegexField
java.lang.Object
  extended by toolbox.web.validation.AbstractField
      extended by toolbox.web.validation.StringField
          extended by toolbox.web.validation.RegexField
All Implemented Interfaces:
Field
Direct Known Subclasses:
RSAIdentityNumberField

public class RegexField
extends StringField

Field implementation to validate String inputs using regular expressions.

This implementation supports three validation properties:


Constructor Summary
RegexField()
          Defualt constructor
 
Method Summary
 java.lang.Object validate(java.lang.String value, java.util.ResourceBundle bundle)
          Validate the given String against the configured regex pattern.
 
Methods inherited from class toolbox.web.validation.AbstractField
getDefault, getName, getPattern, getProperties, getProperty, getResourceKey, getResourceString, getResourceString, isRequired, setDefault, setName, setPattern, setProperties, setRequired, setResourceKey, validateRequired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexField

public RegexField()
Defualt constructor

Method Detail

validate

public java.lang.Object validate(java.lang.String value,
                                 java.util.ResourceBundle bundle)
                          throws ValidationException
Validate the given String against the configured regex pattern.

Specified by:
validate in interface Field
Overrides:
validate in class StringField
Parameters:
value - String value to validate.
bundle - ResourceBundle to use for localised messages.
Returns:
Object containing the result of the validation.
Throws:
ValidationException - if the String does not contain a valid value.