org.exolab.castor.xml.validators
Class PatternValidator
java.lang.Object
org.exolab.castor.xml.validators.PatternValidator
public abstract class PatternValidator
extends java.lang.Object
A simple abstract class used for validating types which allow the pattern
facet.
$Revision: 7273 $ $Date: 2004-12-11 02:13:52 -0700 (Sat, 11 Dec 2004) $
PatternValidator() - Creates a new PatternValidator with no initial regular expression.
|
PatternValidator(String pattern) - Creates a new PatternValidator with the given initial regular expression.
|
void | addPattern(String pattern) - Sets the regular expression to validate against.
|
void | clearPatterns() - Clear all configured patterns.
|
String | getPattern() - since Castor 1.1, use
getPatterns()
|
List | getPatterns() - Returns the collection of regular expression patterns.
|
boolean | hasPattern() - Returns true if a regular expression has been set for this
PatternValidator.
|
boolean | isNillable() - Returns whether or not objects validated by this Validator are nillable
(are allowed to be null).
|
void | setNillable(boolean nillable) - Sets whether or not objects validated by this Validator are allowed to be
null (nillable).
|
void | setPattern(String pattern) - since Castor 1.1, use
addPattern(String)
|
void | validate(Object object, ValidationContext context) - Validates the given Object.
|
void | validate(String str, ValidationContext context) - Validates the given String against the regular expression pattern of this
PatternValidator.
|
PatternValidator
public PatternValidator()
Creates a new PatternValidator with no initial regular expression.
PatternValidator
public PatternValidator(String pattern)
Creates a new PatternValidator with the given initial regular expression.
pattern
- the regular expression to validate against
addPattern
public void addPattern(String pattern)
Sets the regular expression to validate against.
pattern
- the regular expression to use when validating
clearPatterns
public void clearPatterns()
Clear all configured patterns.
getPattern
public String getPattern()
since Castor 1.1, use getPatterns()
Returns the first regular expression pattern for this PatternValidator,
or null if no pattern has been set.
- the regular expression pattern
getPatterns
public List getPatterns()
Returns the collection of regular expression patterns.
- the collection of regular expression patterns.
hasPattern
public boolean hasPattern()
Returns true if a regular expression has been set for this
PatternValidator.
- true if a regular expression has been set for this
PatternValidator
isNillable
public boolean isNillable()
Returns whether or not objects validated by this Validator are nillable
(are allowed to be null).
- true if null is a valid value
setNillable
public void setNillable(boolean nillable)
Sets whether or not objects validated by this Validator are allowed to be
null (nillable).
nillable
- a boolean that when true indicates null values pass validation
setPattern
public void setPattern(String pattern)
since Castor 1.1, use addPattern(String)
Sets the regular expression to validate against. Deprecated since
Castor 1.1, supports only one pattern to preserve old behavior. Use
addPattern(String)
.
pattern
- the regular expression to use when validating
validate
public void validate(Object object,
ValidationContext context)
throws ValidationException
Validates the given Object.
object
- the Object to validatecontext
- the ValidationContext
validate
public void validate(String str,
ValidationContext context)
throws ValidationException
Validates the given String against the regular expression pattern of this
PatternValidator.
str
- the string to validatecontext
- the validation context
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com