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

Answer by Jonathan for Retrieve generic type information with reflection

$
0
0

The only way this is workable is if you subclass StringObjectKeyValueStore:

class FriendStore extends StringObjectKeyValueStore<Friend>{}

The you can resolve V for a particular type, such as KeyValueStore, using TypeTools (which I authored):

Class<?> v = TypeResolver.resolveRawArguments(KeyValueStore.class, FriendStore.class)[1];assert v == Friend.class;

Viewing all articles
Browse latest Browse all 40

Trending Articles



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