Created
July 5, 2013 19:25
-
-
Save lfo/5936662 to your computer and use it in GitHub Desktop.
Some usefull reflection method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.ParameterizedType; | |
public class ClassUtil { | |
public static Class getParameterClass(Class parametizedClass, int index) { | |
return (Class) ((ParameterizedType) parametizedClass.getGenericInterfaces()[0]).getActualTypeArguments()[index]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment