I THINK you can just do:

@XmlSchemaType(name="float", type=Number.class)

to handle this.   You can add that to the package-info.java as well to make it 
a package level thing.

Dan


On Monday 24 January 2011 3:26:07 am Tamas Kis wrote:
> We were spending quite a time on trying to bind java.lang.Number to
> Float per default with some TypeAdapter-s.
> The problem is that @XmlTypeAdapterXY can't be injected into our
> Webservice POJO-s that are generated dynamically (with recursive user
> defined parameters that may contain any type -> framework should be
> configured to handle Number to Float binding).
> 
> Due to the mapping of a Java class, the TypeAdapter annotation can't be
> added to the "original class to be bound" either (because the class if
> from the JRE: java.lang.Number, we can't change it).
> 
> We use JAXB binding, and according to JAXB there are some possibilities
> to configure such bindings:
>  - package level configuration for the default parameters of the
> Context. These parameters just seems not to work in this case (but for
> other settings).
>  - a configuration file to append own type bindings. Well, in CXF we
> found 20+ candidates by extension, but which file should be changed for
> this? This should be the straightforward way, i think. Could anybody
> tell us which file to change?
> 
> (in the documentation such a binding file is always explicitly
> specified, because these examples all rely on manual generation of Web
> services - our SW deploys POJO-s as they are using CXF, consequently
> everything is generated under the hood of CXF nicely)
> 
> Thanks in advance!
> Tamas

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to