org.exolab.castor.xml

Class FieldValidator

public class FieldValidator extends Validator

Handles field validation

Version: $Revision: 6216 $ $Date: 2004-10-08 22:58:55 -0600 (Fri, 08 Oct 2004) $

Author: Keith Visco

Constructor Summary
FieldValidator()
Creates a default FieldValidator
FieldValidator(TypeValidator validator)
Creates a new FieldValidator using the given TypeValidator
Method Summary
intgetMaxOccurs()
Returns the maximum number of occurances for a given object.
intgetMinOccurs()
Returns the mimimum number of occurances for a given object.
TypeValidatorgetTypeValidator()
Returns true if a TypeValidator has been set
booleanhasTypeValidator()
Returns true if a TypeValidator has been set
voidsetDescriptor(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.
voidsetMaxOccurs(int maxOccurs)
Sets the maximum number of occurances for a given object
voidsetMinOccurs(int minOccurs)
Sets the mimimum number of occurances for a given object
voidsetValidator(TypeValidator validator)
voidvalidate(Object object, ValidationContext context)
Validates the given Object

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

getMaxOccurs

public int getMaxOccurs()
Returns the maximum number of occurances for a given object.

Returns: The maximum number of occurances for a given object. A negative value denotes no upper bound.

getMinOccurs

public int getMinOccurs()
Returns the mimimum number of occurances for a given object.

Returns: The mimimum number of occurances for a given object. A zero value denotes no lower bound (ie. the object is optional).

getTypeValidator

public TypeValidator getTypeValidator()
Returns true if a TypeValidator has been set

Returns: true if a TypeValidator has been set

hasTypeValidator

public boolean hasTypeValidator()
Returns true if a TypeValidator has been set

Returns: true if a TypeValidator has been set

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

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.

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)

setValidator

public void setValidator(TypeValidator validator)

validate

public void validate(Object object, ValidationContext context)
Validates the given Object

Parameters: object the Object that contains the field to validate context the ValidationContext

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