Code example for Constructor

Methods: getGenericParameterTypes

0
        assertParameterizedType(listA.getGenericType(), List.class, aClass);
    } 
 
    public void testConstructorGenericType() throws Exception { 
        Constructor<?> constructor = fClass.getDeclaredConstructors()[0];
        Type[] parameters = constructor.getGenericParameterTypes();
        assertParameterizedType(parameters[0], bClass, String.class);
        assertParameterizedType(parameters[1], List.class, aClass);
    } 
 
    public void testMethodGenericReturnType() throws Exception { 
        Method method = fClass.getDeclaredMethod("method", bClass, List.class);
        assertParameterizedType(method.getGenericReturnType(), bClass, String.class);
    } 
 
    public void testMethodGenericParameterTypes() throws Exception { 
        Method method = fClass.getDeclaredMethod("method", bClass, List.class);
        Type[] types = method.getGenericParameterTypes();
        assertEquals(2, types.length);
        assertParameterizedType(types[0], bClass, String.class);