// Example: Class<T>
if (genericType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) genericType;
for (Type type : parameterizedType.getActualTypeArguments()) {
ITypeDeclaration typeParameter = buildTypeDeclaration(type);
parameterTypes.add(typeParameter);
}
}
// T[]
else if (genericType instanceof GenericArrayType) {
GenericArrayType genericArrayType = (GenericArrayType) genericType;
parameterTypes.add(buildTypeDeclaration(genericArrayType.getGenericComponentType()));
}
// Example: Class
else if (genericType.getClass() == Class.class) {
ITypeDeclaration typeParameter = buildTypeDeclaration((Class<?>) genericType);
parameterTypes.add(typeParameter);
}
// Example: <K, V>
else if (genericType.getClass() == Class[].class) {
for (Class<?> javaType : ((Class<?>[]) genericType)) {
ITypeDeclaration typeParameter = buildTypeDeclaration(javaType);
parameterTypes.add(typeParameter);
}
}
// Example: <K, V>
else if (genericType.getClass() == IType[].class) {
for (IType type : ((IType[]) genericType)) {
ITypeDeclaration typeParameter = new JavaTypeDeclaration(typeRepository, type, null, false);
parameterTypes.add(typeParameter);
}
}
return parameterTypes.toArray(new ITypeDeclaration[parameterTypes.size()]);