You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jason Chaffee <ja...@zilliontv.tv> on 2009/01/19 10:51:30 UTC
Is it possible to use jaxb extension classes in jaxb cxf-su
I like to keep my code as OO as possible. Therefore, I often add behaviors to my jaxb generated classes by extending the generated classes and creating a custom jaxb ObjectFactory that is passed into the JAXBContext to be used during unmarshalling. This will give me back my custom class instead of the generated class. This way I can add behaviors directly on the object itself instead of writing procedural code to operate on the object. Here is the JAXB documentation on the subject: https://jaxb.dev.java.net/guide/Adding_behaviors.html
Is there a way to support this in a cxf-su? If I try to use my custom class, I get an error because of a type mismatch. Therefore, I would need a way to tell cxf to use my custom ObjectFactory, but I haven't found a way to it.
Thanks,
Jason
RE: Is it possible to use jaxb extension classes in jaxb cxf-su
Posted by Jason Chaffee <ja...@zilliontv.tv>.
Great. Thanks.
-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: Monday, January 19, 2009 9:28 AM
To: users@cxf.apache.org
Cc: Jason Chaffee
Subject: Re: Is it possible to use jaxb extension classes in jaxb cxf-su
The easiest way to accomplish this is to add something like:
@XmlSeeAlso(MyObjectFactory.class)
To your SEI interface and Impl class. That should allow the runtime to pick
up your object factory class and add it to the context.
Dan
On Monday 19 January 2009 4:51:30 am Jason Chaffee wrote:
> I like to keep my code as OO as possible. Therefore, I often add behaviors
> to my jaxb generated classes by extending the generated classes and
> creating a custom jaxb ObjectFactory that is passed into the JAXBContext to
> be used during unmarshalling. This will give me back my custom class
> instead of the generated class. This way I can add behaviors directly on
> the object itself instead of writing procedural code to operate on the
> object. Here is the JAXB documentation on the subject:
> https://jaxb.dev.java.net/guide/Adding_behaviors.html
>
>
>
> Is there a way to support this in a cxf-su? If I try to use my custom
> class, I get an error because of a type mismatch. Therefore, I would need
> a way to tell cxf to use my custom ObjectFactory, but I haven't found a way
> to it.
>
> Thanks,
>
> Jason
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Re: Is it possible to use jaxb extension classes in jaxb cxf-su
Posted by Daniel Kulp <dk...@apache.org>.
The easiest way to accomplish this is to add something like:
@XmlSeeAlso(MyObjectFactory.class)
To your SEI interface and Impl class. That should allow the runtime to pick
up your object factory class and add it to the context.
Dan
On Monday 19 January 2009 4:51:30 am Jason Chaffee wrote:
> I like to keep my code as OO as possible. Therefore, I often add behaviors
> to my jaxb generated classes by extending the generated classes and
> creating a custom jaxb ObjectFactory that is passed into the JAXBContext to
> be used during unmarshalling. This will give me back my custom class
> instead of the generated class. This way I can add behaviors directly on
> the object itself instead of writing procedural code to operate on the
> object. Here is the JAXB documentation on the subject:
> https://jaxb.dev.java.net/guide/Adding_behaviors.html
>
>
>
> Is there a way to support this in a cxf-su? If I try to use my custom
> class, I get an error because of a type mismatch. Therefore, I would need
> a way to tell cxf to use my custom ObjectFactory, but I haven't found a way
> to it.
>
> Thanks,
>
> Jason
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog