Package org.exolab.castor.xml.validators
Class SimpleTypeValidator
java.lang.Object
org.exolab.castor.xml.validators.SimpleTypeValidator
- All Implemented Interfaces:
TypeValidator
A class for defining simple rules used for validating a content model.
- Version:
- $Revision$ $Date: 2004-10-01 07:25:46 -0600 (Fri, 01 Oct 2004) $
- Author:
- Keith Visco
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a default SimpleTypeValidator.SimpleTypeValidator
(TypeValidator validator) Creates a SimpleTypeValidator using the given TypeValidator for delegating validation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setMaxOccurs
(int maxOccurs) Sets the maximum number of times that the described field may occur.void
setMinOccurs
(int minOccurs) Sets the minimum number of times that the described field may occur.void
setValidator
(TypeValidator validator) Sets the TypeValidator to delegate validation to.void
validate
(Object object, ValidationContext context) Validates the given Object.
-
Constructor Details
-
SimpleTypeValidator
public SimpleTypeValidator()Creates a default SimpleTypeValidator. -
SimpleTypeValidator
Creates a SimpleTypeValidator using the given TypeValidator for delegating validation.- Parameters:
validator
- The TypeValidator to use
-
-
Method Details
-
setMaxOccurs
public void setMaxOccurs(int maxOccurs) Sets the maximum number of times that the described field may occur.- Parameters:
maxOccurs
- the maximum number of times that the described field may occur.
-
setMinOccurs
public void setMinOccurs(int minOccurs) Sets the minimum number of times that the described field may occur.- Parameters:
minOccurs
- the minimum number of times that the described field may occur.
-
setValidator
Sets the TypeValidator to delegate validation to.- Parameters:
validator
- the TypeValidator to delegate validation to.
-
validate
Validates the given Object.- Specified by:
validate
in interfaceTypeValidator
- Parameters:
object
- the Object to validate.context
- the ValidationContext.- Throws:
ValidationException
- if validation fails.
-