org.exolab.castor.xml.handlers

Class CollectionFieldHandler

public class CollectionFieldHandler extends XMLFieldHandler

A FieldHandler for the XML Schema Collection type. TODO : support all kind of XSList

Version: $Revision: 1.1.1.1 $ $Date: 2003/03/03 07:09:26 $

Author: Arnaud Blandin

Constructor Summary
CollectionFieldHandler(FieldHandler fieldHandler)
Creates a new CollectionFieldHandler using the given FieldHandler for delegation.
CollectionFieldHandler(FieldHandler fieldHandler, TypeValidator validator)
Method Summary
voidcheckValidity(Object object)
Checks the field validity.
booleanequals(Object obj)
Returns true if the given object is an XMLFieldHandler that is equivalent to the delegated handler.
ObjectgetValue(Object target)
Gets the value of the field associated with this descriptor.
ObjectnewInstance(Object parent)
Creates a new instance of the object described by this field.
voidresetValue(Object target)
voidsetValue(Object target, Object value)
Sets the value of the field associated with this descriptor.

Constructor Detail

CollectionFieldHandler

public CollectionFieldHandler(FieldHandler fieldHandler)
Creates a new CollectionFieldHandler using the given FieldHandler for delegation.

Parameters: fieldHandler the fieldHandler for delegation.

CollectionFieldHandler

public CollectionFieldHandler(FieldHandler fieldHandler, TypeValidator validator)

Method Detail

checkValidity

public void checkValidity(Object object)
Checks the field validity. Returns successfully if the field can be stored, is valid, etc, throws an exception otherwise.

Parameters: object The object

Throws: ValidityException The field is invalid, is required and null, or any other validity violation IllegalStateException The Java object has changed and is no longer supported by this handler, or the handler is not compatiable with the Java object

equals

public boolean equals(Object obj)
Returns true if the given object is an XMLFieldHandler that is equivalent to the delegated handler. An equivalent XMLFieldHandler is an XMLFieldHandler that is an instances of the same class.

Returns: true if the given object is an XMLFieldHandler that is equivalent to this one.

getValue

public Object getValue(Object target)
Gets the value of the field associated with this descriptor. If the value is an array, it returns a string 'representing' this array

Parameters: target the object in which to set the value value the value of the field

newInstance

public Object newInstance(Object parent)
Creates a new instance of the object described by this field.

Parameters: parent The object for which the field is created

Returns: A new instance of the field's value

Throws: IllegalStateException This field is a simple type and cannot be instantiated

resetValue

public void resetValue(Object target)

setValue

public void setValue(Object target, Object value)
Sets the value of the field associated with this descriptor.

Parameters: target the object in which to set the value value the value of the field

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