dev@jsr311.java.net

Re: "Dual dispatch"

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Thu, 26 Apr 2007 11:18:17 +1000

On 4/22/07, Marc Hadley <Marc.Hadley_at_sun.com> wrote:
>
> On Apr 21, 2007, at 12:24 AM, Dhanji R. Prasanna wrote:
> > @URITemplate(...)
> > @Externalizer(Class<T>, Class<? extends
> > TypeStreamingProvider<T>>) //example psuedo-signature
> > public class InvoicesService {
> > //..
> > }
> >
> An annotation approach could also be good, in fact an annotation
> could be used to generate the ServiceFinder configuration files
> during apt processing.


Yep, it also allows you to override entity-externalizers on a per-resource
basis from the global registry.


> > @Produces(@MediaType("application/invoice+xml"), @MediaType
> > ("application/json"), @MediaType(MediaTypes.TEXT_PLAIN)) //etc.
> > @HttpMethod
> > Invoices getInvoices() { ... }
> >
> All those @MediaType annotations in the @Produces look a little
> superfluous.


I was just using it to illustrate the contractual safety of formal
parameters as opposed to a string-glob with an implicit grammar. This would
be equally feasible:

@ProduceMime( { "application/invoice+xml", MediaTypes.TEXT_PLAIN ... } )

It's not a major point but small considerations like this are important in
api design.

It sounds like there's general agreement that custom+portable
> serializers is a desirable feature though.


+1.
I would go one step further and say "a desirable *high-level* feature."

Dhanji.