Re: Proposal for rework of spi package (was Re: "Dual dispatch")

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 30 Apr 2007 12:10:54 -0400

On Apr 26, 2007, at 10:30 AM, Stefan Tilkov wrote:
>> I'd only expect generic type providers like a JAXB provider or a
>> String provider to omit the type property in the @Externalizer
>> annotation since they don't much care what the media type is, they
>> just read and write the data regardless.
> I don't understand this. In the example you gave
>> @Externalizer(classes={Thing.class}, type="application/thing")
>> public class ThingExternalizer implements
>> TypeStreamingProvider<Thing.class> {...}
> I would say it's more likely that the classes (e.g. Thing.class) is
> left out, not the type ("application/thing") - i.e. a generic
> serializer may be able to serialize all Java classes to
> "application/json" or "application/xml".

I think there are use cases for omitting either.

> (Additionally, maybe type should better be called "mediatype" or
> "contenttype").
Either works if we make them plural since you can provide a list of
types. Of the two I've a slight preference for "contentTypes".


Marc Hadley <marc.hadley at>
CTO Office, Sun Microsystems.