feat: 提供诸多简化配置,更轻松实现功能

This commit is contained in:
wangyu 2021-09-05 00:42:09 +08:00
parent 4909c17f90
commit 913325cfa1

View File

@ -79,7 +79,7 @@ public class BeanProperty {
property.setReadonly(true);
return property;
}
// 如果是qo或者vo处于严格模式z
// 如果是qo或者vo处于严格模式
boolean strict = Qo.class.isAssignableFrom(beanClass) || Vo.class.isAssignableFrom(beanClass);
// 尝试获取field
Field field = FieldUtils.getField(beanClass, descriptor.getName(), true);
@ -87,11 +87,13 @@ public class BeanProperty {
if (null != field) {
Property props = AnnotationUtils.findAnnotation(field, Property.class);
if (null != props) {
String parentName = Optional.ofNullable(beanClass.getAnnotation(RestBean.class)).map(RestBean::name).orElse("");
String parentName = Optional.ofNullable(beanClass.getAnnotation(RestBean.class))
.map(RestBean::name).orElse("");
property.setTitle(props.inherited() ? parentName + props.title() : props.title());
property.setDescription(props.description());
property.setReadonly(props.readonly());
property.setGroup(props.group());
// 优雅地设置排序
Order order = AnnotationUtils.findAnnotation(field, Order.class);
if (null != order) {
property.setOrder(order.value());