|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.validators.PatternValidator
public abstract class PatternValidator
A simple abstract class used for validating types which allow the pattern facet.
Constructor Summary | |
---|---|
PatternValidator()
Creates a new PatternValidator with no initial regular expression. |
|
PatternValidator(java.lang.String pattern)
Creates a new PatternValidator with the given initial regular expression. |
Method Summary | |
---|---|
void |
addPattern(java.lang.String pattern)
Sets the regular expression to validate against. |
void |
clearPatterns()
Clear all configured patterns. |
java.util.List<java.lang.String> |
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 |
validate(java.lang.Object object,
ValidationContext context)
Validates the given Object. |
void |
validate(java.lang.String str,
ValidationContext context)
Validates the given String against the regular expression pattern of this PatternValidator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PatternValidator()
PatternValidator
with no initial regular expression.
public PatternValidator(java.lang.String pattern)
PatternValidator
with the given initial regular expression.
pattern
- the regular expression to validate againstMethod Detail |
---|
public java.util.List<java.lang.String> getPatterns()
#setPattern
public boolean isNillable()
public boolean hasPattern()
public void setNillable(boolean nillable)
nillable
- a boolean that when true indicates null values pass validationpublic void addPattern(java.lang.String pattern)
pattern
- the regular expression to use when validatingpublic void clearPatterns()
public void validate(java.lang.String str, ValidationContext context) throws ValidationException
str
- the string to validatecontext
- the validation context
ValidationException
- if the given String is not matched by the regular expression
pattern#setPattern
public void validate(java.lang.Object object, ValidationContext context) throws ValidationException
object
- the Object to validatecontext
- the ValidationContext
ValidationException
- if the given String is not matched by the regular expression
pattern
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |