I'd extract the generic extraction to a method:

```java
Class<?>[] parameterTypes = method.getMethod().getParameterTypes();
Type genericType = getGenericType(method.getResource().getType);
if (genericType != null) {
    for ...
}
return parameterTypes;
```