Got it. Thank you very much, Bill!

-----Urspr√ľngliche Nachricht-----
Von: Bill Burke [mailto:bbu...@redhat.com] 
Gesendet: Dienstag, 13. August 2013 17:07
An: resteasy-users@lists.sourceforge.net
Betreff: Re: [Resteasy-users] Why is GenericEntity an abstract class?

THe sole purpose of GenericEntity (and GenericType) is Java type erasure.
Take this example:

List<Customer> list = ...;

return Response.ok(list).build();


With this, Resteasy has no clue about the generic type of "list".  All it
knows is that it is a java.util.List.  Java just doesn't let you derive the
generic type at runtime.  GenericEntity/Type is a hack. 
Generic type information of extended superclasses *IS* stored and remembered
by the java runtime.  So this anonymous class is using this trick to obtain
generic type information.  Follow now?

On 8/13/2013 10:55 AM, Juergen Zimmermann wrote:
> When I need an instance of GenericEntity I've to create an object of 
> an anonymous class derived from GenericEntity. Therefore, I'm 
> wondering why GenericEntity isn't a concrete class? Any hint is
appreciated.
>
> Regards,
> Juergen
>
>
> ----------------------------------------------------------------------
> -------- Get 100% visibility into Java/.NET code with AppDynamics 
> Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.c
> lktrk _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>

--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

----------------------------------------------------------------------------
--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to