velosurf.validation
Class Regex

java.lang.Object
  extended by velosurf.validation.FieldConstraint
      extended by velosurf.validation.Regex

public class Regex
extends FieldConstraint

A regular expression pattern constraint. Syntax is:

    <column regex="regex-pattern"/>
  

Or:

     <column>
       <regex pattern="regex-pattern" [message="error-message"] >
     </column>
   

Note: this constraint is not meant to replace an internal SQL constraint clause in the database, since it cannot be made sure that complex updates will respect this constraint.

Author:
Claude Brisson

Field Summary
protected  java.util.regex.Pattern _pattern
           
 
Fields inherited from class velosurf.validation.FieldConstraint
_message
 
Constructor Summary
Regex(java.util.regex.Pattern pattern)
          Constructor.
 
Method Summary
 java.lang.String toString()
           
 boolean validate(java.lang.Object data)
           
 
Methods inherited from class velosurf.validation.FieldConstraint
getMessage, setMessage, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_pattern

protected java.util.regex.Pattern _pattern
Constructor Detail

Regex

public Regex(java.util.regex.Pattern pattern)
Constructor.

Parameters:
pattern - the regex pattern to be matched
Method Detail

validate

public boolean validate(java.lang.Object data)
Overrides:
validate in class FieldConstraint
Parameters:
data - the data to be validated
Returns:
true if data matches the regex pattern

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


~ooOoo~