org.springframework.rules.constraint
Class RegexpConstraint
java.lang.Object
org.springframework.rules.reporting.TypeResolvableSupport
org.springframework.rules.constraint.RegexpConstraint
- All Implemented Interfaces:
- MessageSourceResolvable, Constraint, TypeResolvable
public class RegexpConstraint
- extends TypeResolvableSupport
- implements Constraint
A constraint based on a regular expression pattern.
- Author:
- Keith Donald
- See Also:
TypeResolvable,
Pattern
|
Constructor Summary |
RegexpConstraint(String regex)
Creates a RegexpConstraint with the provided regular expression pattern
string. |
RegexpConstraint(String regex,
String type)
Creates a RegexpConstraint with the provided regular expression pattern
string and sets the type of the constraint to provide specific messages. |
RegexpConstraint
public RegexpConstraint(String regex)
- Creates a RegexpConstraint with the provided regular expression pattern
string.
- Parameters:
regex - The regular expression
RegexpConstraint
public RegexpConstraint(String regex,
String type)
- Creates a RegexpConstraint with the provided regular expression pattern
string and sets the type of the constraint to provide specific messages.
- Parameters:
regex - the regular expression.type - id used to fetch the message.
test
public boolean test(Object argument)
- Test if the argument matches the pattern.
- Specified by:
test in interface Constraint
- Parameters:
argument - the argument value
- Returns:
true if the condition was satisfied,
false otherwise
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2004-2009 The Spring Framework. All Rights Reserved.