org.exolab.castor.xml
Class FieldValidator

java.lang.Object
  |
  +--org.exolab.castor.xml.Validator
        |
        +--org.exolab.castor.xml.FieldValidator

public class FieldValidator
extends Validator

Handles field validation

Version:
$Revision: 1.3 $ $Date: 2001/02/12 22:49:25 $
Author:
Keith Visco

Constructor Summary
FieldValidator()
          Creates a default FieldValidator
FieldValidator(TypeValidator validator)
          Creates a new FieldValidator using the given TypeValidator
 
Method Summary
 boolean hasTypeValidator()
           
 void setDescriptor(XMLFieldDescriptor descriptor)
          Sets the field descriptor to use for obtaining information about the field to validate, such as the field name, the field handler, etc.
 void setMaxOccurs(int maxOccurs)
          Sets the maximum number of occurances for a given object
 void setMinOccurs(int minOccurs)
          Sets the mimimum number of occurances for a given object
 void setValidator(TypeValidator validator)
           
 void validate(java.lang.Object object, ClassDescriptorResolver resolver)
          Validates the given Object
 
Methods inherited from class org.exolab.castor.xml.Validator
validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldValidator

public FieldValidator()
Creates a default FieldValidator

FieldValidator

public FieldValidator(TypeValidator validator)
Creates a new FieldValidator using the given TypeValidator
Parameters:
validator - the TypeValidator to delegate validation to
Method Detail

hasTypeValidator

public boolean hasTypeValidator()

setMinOccurs

public void setMinOccurs(int minOccurs)
Sets the mimimum number of occurances for a given object
Parameters:
minOccurs - the minimum number of times an object must occur in order to be valid. A zero, or negative value denotes no lower bound (ie. the object is optional)

setMaxOccurs

public void setMaxOccurs(int maxOccurs)
Sets the maximum number of occurances for a given object
Parameters:
maxOccurs - the maximum number of times an object may occur. A negative value denotes no upper bound.

setDescriptor

public void setDescriptor(XMLFieldDescriptor descriptor)
Sets the field descriptor to use for obtaining information about the field to validate, such as the field name, the field handler, etc.
Parameters:
descriptor - the field descriptor for the field to validate

setValidator

public void setValidator(TypeValidator validator)

validate

public void validate(java.lang.Object object,
                     ClassDescriptorResolver resolver)
              throws ValidationException
Validates the given Object
Overrides:
validate in class Validator
Parameters:
object - the Object that contains the field to validate
validator - the Validator to use to perform validation of individual objects. This validator is not guaranteed to be called.


Intalio Inc. (C) 1999-2001. All rights reserved http://www.intalio.com