Package org.exolab.castor.xml.validators
Class NameValidator
- java.lang.Object
-
- org.exolab.castor.xml.validators.PatternValidator
-
- org.exolab.castor.xml.validators.StringValidator
-
- org.exolab.castor.xml.validators.NameValidator
-
- All Implemented Interfaces:
TypeValidator
public class NameValidator extends StringValidator
The Name Validation class. This class handles validation for XML Name production types such as NCName and NMToken- Version:
- $Revision: 6605 $ $Date: 2005-12-13 14:58:48 -0700 (Tue, 13 Dec 2005) $
- Author:
- Keith Visco
-
-
Field Summary
Fields Modifier and Type Field Description static shortCDATAXML name type CDATA.static shortNCNAMEXML name type NCName.static shortNMTOKENXML name type NMTOKEN.-
Fields inherited from class org.exolab.castor.xml.validators.PatternValidator
resourceBundle
-
-
Constructor Summary
Constructors Constructor Description NameValidator()Creates a new NameValidator with the default validation set to NCName.NameValidator(short type)Creates a new NameValidator with the given validation type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetRequired(boolean required)Sets whether or not a String is required (non null).voidvalidate(java.lang.Object object)Validates the given Object.voidvalidate(java.lang.Object object, ValidationContext context)Validates the given Object.voidvalidate(java.lang.String value, ValidationContext context)Validates the given Object.-
Methods inherited from class org.exolab.castor.xml.validators.StringValidator
clearFixed, normalize, setFixed, setFixedValue, setLength, setMaxLength, setMinLength, setWhiteSpace
-
Methods inherited from class org.exolab.castor.xml.validators.PatternValidator
addPattern, clearPatterns, getPatterns, hasPattern, isNillable, setNillable
-
-
-
-
Field Detail
-
NCNAME
public static final short NCNAME
XML name type NCName. @deprecated - use XMLConstants.NAME_TYPE_NCNAME. Retained for backwards-compatility.- See Also:
- Constant Field Values
-
NMTOKEN
public static final short NMTOKEN
XML name type NMTOKEN. @deprecated - use XMLConstants.NAME_TYPE_NCTOKEN. Retained for backwards-compatility.- See Also:
- Constant Field Values
-
CDATA
public static final short CDATA
XML name type CDATA. @deprecated - use XMLConstants.NAME_TYPE_CDATA. Retained for backwards-compatility.- See Also:
- Constant Field Values
-
-
Method Detail
-
setRequired
public void setRequired(boolean required)
Sets whether or not a String is required (non null).- Overrides:
setRequiredin classStringValidator- Parameters:
required- the flag indicating whether Strings are required
-
validate
public void validate(java.lang.String value, ValidationContext context) throws ValidationExceptionValidates the given Object.- Overrides:
validatein classStringValidator- Parameters:
value- the string to validatecontext- the ValidationContext- Throws:
ValidationException- if the object fails validation.- See Also:
#setPattern
-
validate
public void validate(java.lang.Object object) throws ValidationExceptionValidates the given Object.- Overrides:
validatein classStringValidator- Parameters:
object- the Object to validate- Throws:
ValidationException- if the object fails validation.
-
validate
public void validate(java.lang.Object object, ValidationContext context) throws ValidationExceptionValidates the given Object.- Specified by:
validatein interfaceTypeValidator- Overrides:
validatein classStringValidator- Parameters:
object- the Object to validatecontext- the ValidationContext- Throws:
ValidationException- if the object fails validation.
-
-