dev@jsr311.java.net

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

From: Dhanji R. Prasanna <dhanji_at_gmail.com>
Date: Thu, 26 Apr 2007 20:42:07 +1000

On 4/26/07, Dhanji R. Prasanna <dhanji_at_gmail.com> wrote:
>
>
>
> On 4/26/07, Marc Hadley <Marc.Hadley_at_sun.com> wrote:
> >
> > Thing readFrom(Class<Thing> type, MediaType mediaType,
> > MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
> > throws IOException {
> > ...
> > }
> >
> > void writeTo(Thing t, MediaType mediaType, MultivaluedMap<String,
> > String> httpHeaders, OutputStream entityStream) throws IOException {
> > ...
> > }
> > }
>
>
> Just a lateral suggestion, but I'd like to use java "over-the-wire"
> terminology for the aforementioned methods:
> - marshall/unmarshall
> - serialize/deserialize
> - readExternal/writeExternal
>

Another quick thought--we should support new io interfaces too:

interface TypeChannelingProvider<T> {
    T deserialize(Class<T> type, MediaType mediaType, Map<String, String>
headers, ReadableByteChannel inChannel);

    void serialize(T thing, MediaType mediaType, Map<String, String>
headers, WritableByteChannel outChannel);
}

I would also suggest renaming the interfaces to StreamExternalizer and
BlockExternalizer (or ChannelExternalizer).

Dhanji.