private static void collectParameters(Collection<Parameters> parameters, Parameter parameter, Annotation a,
boolean isPathVariable) {
if (a != null) {
String typeStr = parameter.getType().getSimpleName();
Type type = parameter.getParameterizedType();
if (type instanceof ParameterizedType) {
typeStr = ((Class<?>) ((ParameterizedType) type).getActualTypeArguments()[0]).getSimpleName();
}
parameters.add(new Parameters((boolean) AnnotationUtils.getValue(a, "required"),
(String) (AnnotationUtils.getValue(a).equals("") ? parameter.getName()
: AnnotationUtils.getValue(a)),
typeStr));
} else if (Pageable.class.isAssignableFrom(parameter.getType()) && !isPathVariable) {
try {
for (PropertyDescriptor propertyDescriptor : Introspector.getBeanInfo(parameter.getType())
.getPropertyDescriptors()) {
parameters.add(new Parameters(false, propertyDescriptor.getName(),
propertyDescriptor.getPropertyType().getSimpleName()));
}
} catch (IntrospectionException e) {
LOGGER.error("Problemas al obtener el Pageable: {}", parameter, e);
}
}
}
ReflectionUtils.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:spring-rest-commons-options
作者:
评论列表
文章目录