Hi Jerome,
this question came to my mind when i was thinking about your
suggested approach that a Resource should be able to directly return
a representation (without automagic marshalling) to the callee.
Like you described with 'toJason()' and 'toXML()' for instance.
I would more likely turn this particular question to a point where we
start thinking about the boundary between resource and representation.
What comes to my mind are examples like object-to-xml or
object-to-rdbms mapping. I think we are looking at something similiar
when talk about pojo-to-represenation mapping.
Questions that come to my mind are:
* Is it really desirable to have a resource being in charge of
serialisation?
* Would a layer of indirection (serializer registry) be the better
approach?
* Regarding @MediaType and the like: It's a smart (although simple) to
mix meta-data (i.e. @MediaType) with the actual payload (i.e. JAXB
pojo)
* How does Representation<T> fit into the picture from this point of
view?
Regards, Heiko
On Thu, 12 Apr 2007 09:51:30 +0200
Heiko Braun <hbraun_at_redhat.com> wrote:
> Hi Jerome,
>
> yes it will probably ignore that annotation,
> but the mimeType property that would still get marshalled.
>
> I i did get you right, the @MediaType annotated property
> should not become part of the actual (let's xml) representation on the
> wire.
>
> Regards, Heiko
>
> On Thu, 12 Apr 2007 08:59:17 +0200
> "Jerome Louvel" <jerome.louvel_at_noelios.com> wrote:
>
> >
> > Hi Heiko,
> >
> > > > @MediaType
> > > > public String getMimeType() {...}
> > > >
> > >
> > > Doesn't this clash with Representations that rely on annotations
> > > themselves? I.e. what happens to JAXB annotated classes when
> > > you try to
> > > serialize them and the include a @MediaType property?
> > >
> > > I think it will be serialized as well, but this is probably
> > > not desired
> > > behaviour.
> > >
> > > This probably requires a closer look when thinking about
> > > serializer/deserializer strategies in general.
> >
> > As annotations, like classes, live in namespaces, my expectation is
> > that JAXB will just ignore annotations that are not part of its
> > namespace.
> >
> > Best regards,
> > Jerome
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> > For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>