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

Answer by Jonathan for How to check does interface with generic fit to class

$
0
0

You can use something like TypeTools (a library that I authored) to resolve type arguments so long as the argument is captured in a type definition. For example:

interface DummyStringInterface extends DummyInterface<String> {}Class<?> t = TypeResolver.resolveRawArgument(DummyInterface.class, DummyStringInterface.class);assert t == String.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>