/** * @return The parameter types of the method as an array of {@link Type}s. If they have type parameters in the declaration,<br> * they will be resolved to the actual runtime {@link Type}s. */ public static Type[] resolveParamTypes(Method method, Type srcType) { Type[] paramTypes = method.getGenericParameterTypes(); Class<?> declaringClass = method.getDeclaringClass(); Type[] result = new Type[paramTypes.length]; for (int i = 0; i < paramTypes.length; i++) { result[i] = resolveType(paramTypes[i], srcType, declaringClass); } return result; }
/** * @return The field type as {@link Type}. If it has type parameters in the declaration,<br> * they will be resolved to the actual runtime {@link Type}s. */ public static Type resolveFieldType(Field field, Type srcType) { Type fieldType = field.getGenericType(); Class<?> declaringClass = field.getDeclaringClass(); return resolveType(fieldType, srcType, declaringClass); }
/** * @return The return type of the method as {@link Type}. If it has type parameters in the declaration,<br> * they will be resolved to the actual runtime {@link Type}s. */ public static Type resolveReturnType(Method method, Type srcType) { Type returnType = method.getGenericReturnType(); Class<?> declaringClass = method.getDeclaringClass(); return resolveType(returnType, srcType, declaringClass); }
/** * @return The return type of the method as {@link Type}. If it has type parameters in the declaration,<br> * they will be resolved to the actual runtime {@link Type}s. */ public static Type resolveReturnType(Method method, Type srcType) { Type returnType = method.getGenericReturnType(); Class<?> declaringClass = method.getDeclaringClass(); return resolveType(returnType, srcType, declaringClass); }
/** * @return The field type as {@link Type}. If it has type parameters in the declaration,<br> * they will be resolved to the actual runtime {@link Type}s. */ public static Type resolveFieldType(Field field, Type srcType) { Type fieldType = field.getGenericType(); Class<?> declaringClass = field.getDeclaringClass(); return resolveType(fieldType, srcType, declaringClass); }
/** * @return The parameter types of the method as an array of {@link Type}s. If they have type parameters in the declaration,<br> * they will be resolved to the actual runtime {@link Type}s. */ public static Type[] resolveParamTypes(Method method, Type srcType) { Type[] paramTypes = method.getGenericParameterTypes(); Class<?> declaringClass = method.getDeclaringClass(); Type[] result = new Type[paramTypes.length]; for (int i = 0; i < paramTypes.length; i++) { result[i] = resolveType(paramTypes[i], srcType, declaringClass); } return result; }