Hi Sudir,
I cannot use your patch as is...
the method names conflict for the method which returns the array and the
method which returns the J2 colleciton....
For example if I have a collection of type Foo the following two methods
will be created:
Foo[] getFoo();
java.util.ArrayList getFoo();
and therefore the generated source won't compule.
I also modified the patch as follows:
<diff>
Index: CollectionInfoJ2.java
===================================================================
RCS file:
/cvs/castor/castor/src/main/org/exolab/castor/builder/CollectionInfoJ2.java,v
retrieving revision 1.15
diff -r1.15 CollectionInfoJ2.java
136a137,142
> //-- {collection-type} get{Name}
> JType colType = getSchemaType().getJType();
> method = new JMethod(colType, "get"+cName);
> jClass.addMethod(method);
> createGetCollectionMethod(method);
>
194a201,211
> /**
> * Creates implementation of ArrayList get() method.
> *
> * @param method the JMethod in which to create the source
> * code.
> **/
> public void createGetCollectionMethod(JMethod method) {
> JSourceCode jsc = method.getSourceCode();
> JType jType = method.getReturnType();
> jsc.add("return " + getName() +";");
> } //-- createGetMethodColelction
</diff>
So basically, we have a couple options, we can change the name fo the
method being created for the collection-type, or we can add an option to
choose which method should be generated.
In anycase...I've got a few other items on my plate right now, so I'll
have to come back to this later.
Thanks,
--Keith
Sudhir Bhojwani wrote:
>
> Thanks Keith ! Actually I will have a few more changes in the Source Code
> Generator to make
> the generated code work safely with JDO's lazy loading. May be I will
> comeplete the changes by
> the end of today and send you over the diff file.
>
> Thanks !
> Sudhir
>
> -----Original Message-----
> From: Keith Visco [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 24, 2001 6:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] get method in generated code
>
> Sudhir,
>
> I'll try to review this and get it committed over the weekend.
>
> Thanks,
>
> --Keith
>
> Sudhir Bhojwani wrote:
> >
> > Hi,
> >
> > I noticed Castor generated beans don't have a get method with return type
> > ("Collection" or Vector). The accessor
> > method is useful when trying to use the generated beans with JDO. I was
> > wondering if the code can be modified to
> > generate this. Attached is the diff file.
> >
> > Thanks !
> > Sudhir
> >
> > ------------------------------------------------------------------------
> >
> > diff.javaName: diff.java
> > Type: VisualCafe File
> (application/x-unknown-content-type-VisualCafeFile.Document)
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev