Hi Dariusz,
"Szczesniak, Dariusz" wrote:
>
> Thanks. We tried few different approaches and this one looks very
> promising. It however introduced one new problem. Our existing code
> depends on the fact that all classes contained an unmarshal method, and now
> each of these methods is named differently, ex. unmarshalBook.
The reason for that is due to inheritence. Since the unmarshal method
changes the return type of subclasses, the method name is changed as to
not generate conflicting methods, and hence uncomilable code.
The marshal
> method is named the same in all generated classes. Is there a way to keep
> the unmarshal method name for all classes?
Unfortunately no. The only way you can do that is to have an unmarshal
method which returns all the same type, and therefore require you to
cast your objects.
Feel free to modify SourceFactory (see createUnmarshalMethods) if you
wish to do that.
Another approach, as I pointed out in my previous e-mail on this thread
is to use a modified schema just for generating the source code.
Simply change all the complexType names so they don't clash with the
Element names.
Your original schema doesn't have to change, only the one used to
generator the source code. Since the element names are not changing
(only the complexType names) the generated source code is compatible to
use with instances of your original schema.
--Keith
> --Dariusz.
>
> -----Original Message-----
> From: Sebastien Gignoux [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 30, 2001 7:15 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Problem with the newer version of Castor.
>
> Reynshteyn, Lenny writes:
> > We are experiencing a problem where the new version of Castor behaves
> > differently.
> >
> > We used version 0.8.11 and just swtched to 0.9.2.
> >
> > For the following case, it generated only regular public classes. But the
> > new version generates laso abstract classes for each and the
> corresponding
> > implementation classes. Is there a way to do it the "old way" by
> specifying
> > some command-line arguments or using any other tricks?
> >
> > <xsd:complexType name="Record_type">
> > <xsd:sequence>
> > <xsd:element name="BookProperties" type="BookProperties"/>
> > <xsd:element name="Book" type="Book"/>
> > <xsd:element name="BookIntro" type="BookIntro"/>
>
> > </xsd:sequence>
> > </xsd:complexType>
> >
> >
> > The new Castor generates something like:
> >
> > public class Book extends Book
> > {
> > .....
> > .....
> > }
> >
> > while the old version just generated one "Book" class. Any ideas?
>
> Take a look at:
> http://www.castor.org/sourcegen.html
>
> in the section called 'The type method' and 'The element
> method'. Changing the castorbuilder.properties to use the 'type'
> method might solve your problem.
>
> Seb
>
> >
> > Many thanks.
> > > _____________________________________________
> > > Lenny Reynshteyn
> > Firmwide Internet Group
> > Goldman, Sachs & Co.
> > > Tel: (212) 855-0332
> > > Email: [EMAIL PROTECTED]
> > >
> > >
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
>
> --
> There is a theory which states that if ever anyone discovers exactly
> what the Universe is for and why it is here, it will instantly
> disappear and be replaced by something even more bizarre and
> inexplicable. There is another theory which states that this has
> already happened.
> -- Douglas Adams, The Restaurant at the End of the Universe
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev