Skip to content

Commit 2494a5f

Browse files
[maven-tool] 修改检视意见
1 parent 98a41ad commit 2494a5f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

framework/fel/java/maven-plugins/tool-maven-plugin/src/main/java/modelengine/fel/maven/complie/parser/ByteBuddySchemaParser.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import modelengine.fel.tool.info.entity.ReturnPropertyEntity;
1515
import modelengine.fel.tool.info.entity.SchemaEntity;
1616
import modelengine.fitframework.annotation.Property;
17+
import modelengine.fitframework.util.StringUtils;
1718

1819
import net.bytebuddy.description.annotation.AnnotationDescription;
1920
import net.bytebuddy.description.method.MethodDescription;
@@ -115,11 +116,11 @@ private static PropertyEntity parseProperty(ParameterDescription parameterDescri
115116
entity.setDescription(property.description());
116117
entity.setNeed(property.required());
117118
String defaultValue = property.defaultValue();
118-
if (defaultValue != null && !defaultValue.isEmpty()) {
119+
if (defaultValue != null && !StringUtils.equals(defaultValue, Property.DEFAULT_VALUE)) {
119120
entity.setDefaultValue(defaultValue);
120121
}
121122
String example = property.example();
122-
if (example != null && !example.isEmpty()) {
123+
if (StringUtils.isNotEmpty(example)) {
123124
entity.setExamples(Collections.singletonList(example));
124125
}
125126
}
@@ -135,7 +136,7 @@ private static ReturnPropertyEntity parseReturnProperty(MethodDescription method
135136
returnPropertyEntity.setName(property.name());
136137
returnPropertyEntity.setDescription(property.description());
137138
String example = property.example();
138-
if (example != null && !example.isEmpty()) {
139+
if (StringUtils.isNotEmpty(example)) {
139140
returnPropertyEntity.setExamples(Collections.singletonList(example));
140141
}
141142
}

framework/fel/java/services/tool-service/src/main/java/modelengine/fel/tool/support/MethodToolMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Object parameterDefaultValue(String name) {
6868
Property annotation = parameter.getDeclaredAnnotation(Property.class);
6969
if (annotation != null) {
7070
String defaultValue = annotation.defaultValue();
71-
if (defaultValue != null && !defaultValue.isEmpty()) {
71+
if (defaultValue != null && !StringUtils.equals(defaultValue, Property.DEFAULT_VALUE)) {
7272
return defaultValue;
7373
}
7474
}

framework/fit/java/fit-util/src/main/java/modelengine/fitframework/annotation/Property.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
@Retention(RetentionPolicy.RUNTIME)
2525
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
2626
public @interface Property {
27+
/**
28+
* 参数配置默认值。
29+
*/
30+
String DEFAULT_VALUE = "$$FitDefault$$";
31+
2732
/**
2833
* 获取参数的名字。
2934
*
@@ -50,7 +55,7 @@
5055
*
5156
* @return 表示参数的默认值的 {@link String}。
5257
*/
53-
String defaultValue() default StringUtils.EMPTY;
58+
String defaultValue() default DEFAULT_VALUE; // 修改为全局变量
5459

5560
/**
5661
* 获取参数的样例值。

0 commit comments

Comments
 (0)