Hi Sudhir,
you are correct in that the standard return type for collection
properties is array based. But when you setting the following property
in your builder properties
# Enables generation of extra methods for collection fields, such as
get/set by
# reference and set as copy. Extra methods are in addition to the usual
# collection get/set methods. Set this to true if you want your code to be
# more compatible with Castor JDO.
# False by default.
#
org.exolab.castor.builder.extraCollectionMethods=true
you'll see that additional methods will be generated, such as (in my case):
/**
* Method getChildAsReference.Returns a reference to
* '_childList'. No type checking is performed on any
* modifications to the Vector.
*
* @return a reference to the Vector backing this class
*/
public java.util.Vector<java.lang.String> getChildAsReference(
) {
return this._childList;
}
and
/**
* Sets the value of '_childList' by setting it to the given
* Vector. No type checking is performed.
* @deprecated
*
* @param childVector the Vector to set.
*/
public void setChildAsReference(
final java.util.Vector<java.lang.String> childVector) {
this._childList = childVector;
}
If you are not seeing these additional methods, it might be that you are
mis-configuring the builder property file.
Regards
Werner
Sudhir M wrote:
> Hi,
> We have a requirement to use collections in the source generated by castor.
> The getter and setter method returns an array and takes an array as input.
> Is there a way to change it to take a collection and return a collection.
>
> for example:
>
> Order has items with maxOccurs as unbounded.
>
> The code is generated as private java.util.Vector itemsList; but the getter
> and setter methods returns Items[] and takes Items[] as input. Can we
> generate the code use java.util.List instead of arrays. I have tried using
> the property org.exolab.castor.builder.extraCollectionMethods=true. It
> generates some additional methods to operate the list but the getter and
> setter still uses array.
>
> Any help in this regard is highly appreciated.
>
> Thanks,
> sudhir.
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email