Quantcast
Channel: User Jonathan - Stack Overflow
Viewing all articles
Browse latest Browse all 40

Answer by Jonathan for cannot select Parameterized Type

$
0
0

You can only learn the value of I and R by capturing them in a subclass definition - otherwise they are erased at runtime. Ex:

class MyStringRestHelper extends RestHelper<String, String> {

Then using something like my TypeTools you can resolve the values of I and R:

Class<?>[] typeArgs = TypeResolver.resolveRawArguments(RestHelper.class, MyStringRestHelper.class);Class<?> i = typeArgs[0];Class<?> r = typeArgs[1];assert i == r == String.class;

Viewing all articles
Browse latest Browse all 40

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>