Skip to content

Instantly share code, notes, and snippets.

@mcihad
Created October 28, 2018 18:40
Show Gist options
  • Save mcihad/37404a7e31dc93ea3ce8233a7ae2c4c9 to your computer and use it in GitHub Desktop.
Save mcihad/37404a7e31dc93ea3ce8233a7ae2c4c9 to your computer and use it in GitHub Desktop.
Generic Parameter Type
Type type = this.getClass().getGenericSuperclass();
ParameterizedType pt = (ParameterizedType) type;
Class c = (Class)pt.getActualTypeArguments()[0];
System.out.println(c.getSimpleName());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment