Farrukh Najmi wrote:
> 
> I generated Java Source for my schema using SourceGenerator with the
> "-types j2" command line option. The resulting code indeed used
> java.util.ArrayList instead java.util.Vector. However, that was a
> private data memeber. The public API that was generated still uses:
> 
> -Enumeration instead of Iterator
> 
>     /**
>     **/
>     public java.util.Enumeration enumerateObjectRefListItem()
>     {
>         return new
> org.exolab.castor.util.IteratorEnumeration(_items.iterator());
>     } //-- java.util.Enumeration enumerateObjectRefListItem()
> 
> Instead of
> 
>     public java.util.Iterator iteratorForObjectRefListItem() {
>         return _items.iterator();
>     }

This one needs to be fixed in the CVS...

> 
> -Provides a get method that return an Java Array '[]' instead of an
> ArrayList


This one can be added...but as an option...Even in Java 1.0 collections
we do not expose the actual collection to the user, but rather hide the
implementation of the collection by returning only arrays.

Perhaps we can add castorbuilder.properties flag for this.

> 
>     /**
>     **/
>     public org.oasis.ebxml.registry.bindings.rim.ObjectRefListItem[]
> getObjectRefListItem()
>     {
>         int size = _items.size();
>         org.oasis.ebxml.registry.bindings.rim.ObjectRefListItem[] mArray
> = new org.oasis.ebxml.registry.bindings.rim.ObjectRefListItem[size];
>         for (int index = 0; index < size; index++) {
>             mArray[index] = (ObjectRefListItem) _items.get(index);
>         }
>         return mArray;
>     } //-- org.oasis.ebxml.registry.bindings.rim.ObjectRefListItem[]
> getObjectRefListItem()
> 
> Instead of:
> 
>     public ArrayList getObjectRefListItem() {
>         return (ArrayList)_items.clone();
>     }
> 
> I am quite confused by this unexpected behaviour. 

Are you really that confused by it? It's simple abstraction. Hiding the
implementation details from the user. I'm glad that you at least used
"clone" in your example to prevent the actual array list from being
modified.

> Am I using Castor XML Source Generator incorrectly or are these issues bugs in the 
>latest
> version?

One bug, one possible missing feature.

--Keith

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to