I could see this work, too - but the only reason I suggested mine is that it would be possible
to use the annotations to figure out what the function will return. If I annotate the return types,
it would be much harder to figure out, just by inspection/reflexion, what the client should expect...
(And I think the motivation here was to feed this into some WADL generator ... )
Moises
On Mar 18, 2010, at 11:33 AM, Marc Hadley wrote:
> Rather than annotating the resource method how about annotating the response entity. E.g.
>
> @Status(201)
> @LocationHeader(value="${instance.id})
> pubic class CreatedDomainType extends DomainType {
> ...
> }
>
> pubic class UpdatedDomainType extends DomainType {
> ...
> }
>
> Then you could have your resource method
>
> @POST
> @Produces("application/xml")
> DomainType resourceMethod(...) {
> ...
> if (creatingSomething)
> return new CreatedDomainType(...);
> else
> return new UpdatedDomainType(...);
> }
>
> IOW developers use different return types annotated with type-specific metadata for different kinds of results rather than implementing additional functions to set the metadata.