Re: Representation<T> and Entity<T>

From: Dhanji R. Prasanna <>
Date: Wed, 11 Apr 2007 12:39:04 +1000

On 4/11/07, Marc Hadley <> wrote:
> On Apr 10, 2007, at 2:10 PM, Jerome Louvel wrote:
> I disagree, I could see Representation<File> or
> Representation<InputStream> being used in those cases.

Im with Marc -- the general case wrapper Representation<T> is a simpler
construct than creating a custom wrapper and "selling" it to the jsr311
runtime as the entity.

> >> BTW, in other threads you've already suggested a number of
> >> additional
> >> annotations (e.g. ParentRef, RedirectRef, @Location,
> >> ContentLocation,
> >> Context) - as we explore use cases I'm sure that number would
> >> grow ;-).

I really dont see a problem with lots of annotations. It is totally not on
par with a class explosion. Annotations are simply a nice way to capture
metadata and in that sense little different to static, prepopulated fields.
I think you will find new frameworks and use cases encouraging broader
applications of annotations than merely as placeholders for text values (cf.
google-guice or Apache Tapestry). I would have no problem with an api that
had 15-20 annotations if their purpose were clear and concise. It is
definitely not on par with 15-20 abstract classes or interfaces (with
annotations, there are no operation or data semantics to learn, they are not
extensible and they have limited, well defined targets).

> @Param(type=HEADER|QUERY|MATRIX|URI, name="...")
> but in the end we went for separate annotations @UriParam("..."),
> @QueryParam("..."), @HeaderParam("..."), @MatrixParam("...") for
> mostly aesthetic reasons.

In the same vein, I prefer this approach. I dont see any major advantage to
@Param(type=blah) over @BlahParam. In fact I think it's more confusing and
not as concise for the reasons Paul raised earlier.

> @RedirectRef is strictly equivalent to "ContentLocation" and
> > @Location.
> >
> But the two are different, Location is used outside of redirects,
> e.g. with a 201 response. IMO it would be confusing to use some kind
> of Redirect annotation where you aren't actually redirecting.

Agreed, the name should be more exemplar.