benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

Add TypeLiterals to retrieve parameterized types #117

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I think it would be nice to add the possibility to retrieve parameterized
types (a collection for example) without warning from the compiler.

Currently, you can do the following:

@SuppressWarning("unchecked")
List<String> roles = field("roles").ofType(List.class).in(person).get();

But I think it would be better to do something like this:

List<String> roles = field("roles").ofType(new
TypeLiteral<List<String>>(){}).in(person).get();

I invite you to take a look at guice for details.

What do you think?

Xavier.     

Original issue reported on code.google.com by xavier.d...@gmail.com on 28 Feb 2008 at 7:31

GoogleCodeExporter commented 9 years ago
I like the idea. Thanks Xavier! 

-Alex

Original comment by Alex.Rui...@gmail.com on 28 Feb 2008 at 2:49

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 1:52

GoogleCodeExporter commented 9 years ago
We'll address this issue in version 1.1

Original comment by Alex.Rui...@gmail.com on 10 Dec 2008 at 1:57

GoogleCodeExporter commented 9 years ago
Xavier,

I added support for type literals to fields and static fields. I will continue 
to
work on adding support for methods and static methods.

Changes at r2244 ( http://code.google.com/p/fest/source/detail?r=2244 )

Please feel free to review them.

Thanks,
-Alex

Original comment by Alex.Rui...@gmail.com on 25 Jan 2009 at 8:00

GoogleCodeExporter commented 9 years ago
Minor changes at http://code.google.com/p/fest/source/detail?r=2246

Original comment by Alex.Rui...@gmail.com on 25 Jan 2009 at 8:11

GoogleCodeExporter commented 9 years ago
Fixed. Changes can be reviewed at 
http://code.google.com/p/fest/source/detail?r=2249
(r2249)

Thanks Xavier for suggesting this useful feature :)

-Alex

Original comment by Alex.Rui...@gmail.com on 25 Jan 2009 at 5:44