Java Reflection - Java TypeVariable .getGenericDeclaration ()








Syntax

TypeVariable.getGenericDeclaration() has the following syntax.

D getGenericDeclaration()

Example

In the following code shows how to use TypeVariable.getGenericDeclaration() method.

import java.lang.reflect.TypeVariable;
import java.util.List;
/*from  w  ww .  j av  a 2 s  .  c  om*/
public class Main {
  public static void main(String args[]) throws Exception {

    TypeVariable[] tv = List.class.getTypeParameters();
    System.out.println(tv[0].getGenericDeclaration()); 

  }
}

The code above generates the following result.