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

This commit is contained in:
wangyu 2021-09-05 00:42:09 +08:00
parent 4909c17f90
commit 913325cfa1
1 changed files with 4 additions and 2 deletions

View File

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