"Dual dispatch"

From: Stefan Tilkov <>
Date: Fri, 20 Apr 2007 17:50:44 +0200

Taking an example from Paul:

     Invoices getInvoices() {
         // ...

As Paul wrote, this assumes the "Invoices" JAXB bean has been created.

Some questions:
- Does this mean there can only be one XML "serialization" of
- How do I provide an alternative format, let's say JSON, YAML or HTML?
- Is there a way around the slightly strange "Invoices" JAXB bean,
i.e. can I have an InvoicesResource and a class Invoice, but avoid

I believe we probably need some way for a "dual dispatch" style of
consuming and producing a representation from an object, based on the
Java type *and* the MIME content type - i.e. there may be more than
one content type for a given Java type, and more than one Java type
for a given content type. I don't believe the current proposal
addresses this?


P.S.: This is not my original idea; credit is due to Spring Web
Services creator Arjen Poutsma. Just for the record ;-)

Stefan Tilkov,