in src/main/java/com/epam/digital/data/platform/starter/swagger/apiresponse/validator/ResponseEntityTypeValidator.java [28:40]
public boolean isReturnGenericCollection(HandlerMethod handlerMethod) {
Type responseType = handlerMethod.getMethod().getGenericReturnType();
if (responseType instanceof ParameterizedType) {
ParameterizedType parameterizedResponseType = (ParameterizedType) responseType;
Type genericType = parameterizedResponseType.getActualTypeArguments()[0];
if (genericType instanceof ParameterizedType) {
ParameterizedType parameterizedInnerGenericType = (ParameterizedType) genericType;
Class<?> genericClass = (Class<?>) parameterizedInnerGenericType.getRawType();
return Collection.class.isAssignableFrom(genericClass);
}
}
return false;
}