Code example for Method

Methods: getGenericParameterTypes

0
        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);
        assertParameterizedType(types[1], List.class, aClass);
    } 
 
    static class A {} 
    static class B<T> { 
        T field;
    } 
    static class C<K extends String, V extends A> {}
    interface D<T> {} 
    class E implements Callable<A>, D<A> {
        public A call() throws Exception { 
            return null; 
        }