users@jersey.java.net

Re: [Jersey] Modifying JAXB Behavior for Returned Objects

From: Tim McNerney <java_at_oneofus.org>
Date: Tue, 20 Oct 2009 06:25:28 -0700

Interesting thought that I had not considered. And might work for me in a
couple of cases, but unfortunately, the primary beans I'd be interested in
using this already have a common base class which happens to contain the
fields that I'd like to be able to toggle. I do like the idea in general,
though. It seems reasonably clean to have something like an Article and an
ArticleDetail.
Thanks for the idea.

--Tim

On Mon, Oct 19, 2009 at 11:03 AM, Tatu Saloranta <tsaloranta_at_gmail.com>wrote:

> On Fri, Oct 16, 2009 at 3:27 PM, Tim McNerney <java_at_oneofus.org> wrote:
> > I'm using JAXB notation on a simple bean as a return value for some @GET
> > methods, converted to either JSON or XML. In one case, I am return a
> single
> > instance, but in another, I return a list of items. For the single
> object,
> > I'd like to convert to the complete value, but when returning a list, I'd
> > like an abbreviated representation. Is there any declarative way to do
> this?
>
> You could use different objects for separate cases; with a common
> abstract base class?
> I don't know if it's otherwise cleanly possible -- sounds like you are
> trying to create a union type of sorts, which is not something you
> typically do in Java.
>
> -+ Tatu +-
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>