Java Constructor .getGenericExceptionTypes ()

Syntax

Constructor.getGenericExceptionTypes() has the following syntax.

public Type [] getGenericExceptionTypes()

Example

In the following code shows how to use Constructor.getGenericExceptionTypes() method.


/* ww  w.j  a  v a2s.c  o m*/
import java.lang.reflect.Constructor;
import java.lang.reflect.Member;
import java.lang.reflect.Type;

public class Main {
  public static void main(String[] args) throws ClassNotFoundException {
    Class c = Class.forName("java.util.List");

    Constructor[] constructors = c.getDeclaredConstructors();
    for (int i = 0; i < constructors.length; i++) {
      print_method_or_constructor(constructors[i]);
    }

  }

  public static void print_method_or_constructor(Member member) {
    Constructor c = (Constructor) member;
    Type[] types= c.getGenericExceptionTypes();
  }
}




















Home »
  Java Tutorial »
    java.lang.reflect »




Array
Constructor
Field
Method
Modifier
ParameterizedType
TypeVariable