dev@jsr311.java.net

Re: "Dual dispatch"

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 23 Apr 2007 11:43:02 +0200

Hi,

Just a clarification about support JAXB beans via a type serializer as i
am not sure it is evident from the email discussion.

It is not strictly necessary to register a type provider for each JAXB
bean. The JAXB type provider can check if the a Java type has the
@XmlElement annotation declared on it. Such a provider could be the
default provider for any MIME type used with a JAXB bean.


Stefan Tilkov wrote:
> My suggestion is to add a feature for this to the registry - i.e. the
> key to find the right type serializer should not only be the type, but
> also the media type (or only one of them).

I agree. I think the developer should be able to override default
behavior supported by 311.


> For example, the default way
> to convert objects to and from XML would be JAXB when the JAXB
> serializer is registered for application/xml.

Or any MIME type? e.g. application/foo+xml


> For a type Person, I could
> register a handler for {Person.class, "text/x-vcard"}, for
> {"application/json"}, some generic Object-to-JSON mapper.
>

+1

Paul.
-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109