You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Pieter Cogghe <pi...@gmail.com> on 2007/06/25 11:31:56 UTC
extending the generated classes
Hi,
I want to add some functionality to the generated classes, without touching
the generated classes themselve.
Let say I've got a generated class Instrument and I extend it:
MyInstrument extends Instrument{
// dummy method
public String identify(){
return "MyInstrument";
}
}
Now I want the factory to use this class
InstrumentDocument.Factory.parse(new File("xxx.xml"));
Due to my limited knowledge of XML beans and Java I've no idea how to
accomplish this.
thanks,
Pieter
--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
Re: extending the generated classes
Posted by Pieter Cogghe <pi...@gmail.com>.
Hi Jacob,
I thought of something a little more flexible: maybe by extending the
generated class and passing an instance of this new class as a seed to a
factory. Either way, I think we're stuck with an old version of xml beans.
thanks,
Pieter
2007/6/25, Jacob Danner <ja...@gmail.com>:
>
> Hi Pieter,
> You should be able to use this via the extension mechanism avaiable
> with version 2.2 and later. Here is the blurb from teh release:
> Extensions - You can now add custom functionality to generated
> XMLBeans. You can pass to the Schema Compiler 1) an interface that
> defines the set of methods to implement and 2) a static handler that
> implements this functionality. The generated classes will implement
> the interface and, for each method, call out to the static handler.
>
> I found teh following references online in case you needed more
> information:
> http://wiki.apache.org/xmlbeans/ExtensionInterfacesFeature
>
> http://dev2dev.bea.com/pub/a/2004/05/XMLBeans_raj.html
> http://dev2dev.bea.com/pub/a/2004/11/Configuring_XMLBeans.html
>
> Best of luck,
> -Jacob Danner
>
> On 6/25/07, Pieter Cogghe <pi...@gmail.com> wrote:
> > Hi,
> >
> > I want to add some functionality to the generated classes, without
> touching
> > the generated classes themselve.
> >
> > Let say I've got a generated class Instrument and I extend it:
> >
> > MyInstrument extends Instrument{
> >
> > // dummy method
> > public String identify(){
> > return "MyInstrument";
> > }
> >
> > }
> >
> > Now I want the factory to use this class
> >
> > InstrumentDocument.Factory.parse(new File("xxx.xml "));
> >
> > Due to my limited knowledge of XML beans and Java I've no idea how to
> > accomplish this.
> >
> > thanks,
> >
> > Pieter
> >
> > --
> > Pieter Cogghe
> > Ganzendries 186
> > 9000 Gent
> > 0487 10 14 21
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
Re: extending the generated classes
Posted by Jacob Danner <ja...@gmail.com>.
Hi Pieter,
You should be able to use this via the extension mechanism avaiable
with version 2.2 and later. Here is the blurb from teh release:
Extensions - You can now add custom functionality to generated
XMLBeans. You can pass to the Schema Compiler 1) an interface that
defines the set of methods to implement and 2) a static handler that
implements this functionality. The generated classes will implement
the interface and, for each method, call out to the static handler.
I found teh following references online in case you needed more information:
http://wiki.apache.org/xmlbeans/ExtensionInterfacesFeature
http://dev2dev.bea.com/pub/a/2004/05/XMLBeans_raj.html
http://dev2dev.bea.com/pub/a/2004/11/Configuring_XMLBeans.html
Best of luck,
-Jacob Danner
On 6/25/07, Pieter Cogghe <pi...@gmail.com> wrote:
> Hi,
>
> I want to add some functionality to the generated classes, without touching
> the generated classes themselve.
>
> Let say I've got a generated class Instrument and I extend it:
>
> MyInstrument extends Instrument{
>
> // dummy method
> public String identify(){
> return "MyInstrument";
> }
>
> }
>
> Now I want the factory to use this class
>
> InstrumentDocument.Factory.parse(new File("xxx.xml "));
>
> Due to my limited knowledge of XML beans and Java I've no idea how to
> accomplish this.
>
> thanks,
>
> Pieter
>
> --
> Pieter Cogghe
> Ganzendries 186
> 9000 Gent
> 0487 10 14 21
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org