Code example for Method

Methods: getGenericParameterTypes

0
        assertEquals(BoundedGenericMethods.class, bound);
    } 
 
    /** 
     * Tests whether the specified method declares a parameter with the type of 
     * the type parameter. 
     *  
     * @param method 
     *            the declaring method 
     */ 
    private void parameterType(Method method) {
        TypeVariable<Method> typeParameter = getTypeParameter(method);
        assertLenghtOne(method.getGenericParameterTypes());
        Type genericParameterType = method.getGenericParameterTypes()[0];
        assertEquals(typeParameter, genericParameterType);
        assertTrue(genericParameterType instanceof TypeVariable);
        TypeVariable<?> typeVariable = (TypeVariable<?>) genericParameterType;
        assertEquals(method, typeVariable.getGenericDeclaration());
 
        Type[] paramBounds = typeVariable.getBounds();
        assertLenghtOne(paramBounds);