Member collection=set but argument is object array

View: New views
3 Messages — Rating Filter:   Alert me  

Member collection=set but argument is object array

by Matthew Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

using Castor 1.3

following binding works fine:

        <complexTypeBinding name="/complexType:Base/Tag">
                <member collection="collection"/>
        </complexTypeBinding>

where Tag is an unbounded element to the complexType Base.  The generated class for Base gets the following property:

     private java.util.Collection<java.lang.String> _tagList;

so the underlying property type is correctly set (as a Collection).  However, the set/get pass an object array (of String):

     public void setTag(final java.lang.String[] vTagArray) {

Why?  Want to be able to use a Collection as the parameter.  Reason being is I want a Hibernate collection mapping to map to the Tag property and pass a set/collection.  Do not want to use the Castor mapping facility (and map premade Java POJOs).

Generating my Java classes from xml schemas with the Castor Ant task.

Re: Member collection=set but argument is object array

by Werner Guttmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matthew,

have a look at

http://castor.org/reference/html/xml.code.generator.html#xml.code.generator.properties.detailed.extra.collection

and try to enable the org.exolab.castor.builder.extraCollectionMethods
property.

Regards
Werner

Matthew Young wrote:

> using Castor 1.3
>
> following binding works fine:
>
>         <complexTypeBinding name="/complexType:Base/Tag">
> <member collection="collection"/>
> </complexTypeBinding>
>
> where Tag is an unbounded element to the complexType Base.  The generated
> class for Base gets the following property:
>
>      private java.util.Collection<java.lang.String> _tagList;
>
> so the underlying property type is correctly set (as a Collection).
> However, the set/get pass an object array (of String):
>
>      public void setTag(final java.lang.String[] vTagArray) {
>
> Why?  Want to be able to use a Collection as the parameter.  Reason being is
> I want a Hibernate collection mapping to map to the Tag property and pass a
> set/collection.  Do not want to use the Castor mapping facility (and map
> premade Java POJOs).
>
> Generating my Java classes from xml schemas with the Castor Ant task.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Member collection=set but argument is object array

by Matthew Young :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks for the information.  found the documentation and it works fine.