Annotation Interface DictDesc
This annotation is typically used in Web return objects, for example:
public class OrderInfo {
private String orderStatus;
@DictDesc(OrderStatus.class)
private String orderStatusDesc;
@DictDesc(value = OrderStatus.class, field = "orderStatus")
private String remark;
}
The framework will automatically fill in the text based on the value() specified enum class, finding the matching enum item and assigning its getText() result to the field, provided that the enum class implements the Dict interface.
DictI18nProcessor supports directly processing the annotated object.
For example, when orderStatus is "waitPay", the framework will look for the enum item in the OrderStatus enum class with code() equal to "waitPay" and assign its getText() result to the orderStatusDesc field.
If the field() is not specified, it will default to inferring the corresponding dictionary value field name by removing the "Desc" suffix from the current field name, for example, "orderStatusDesc" corresponds to "orderStatus" field.
If the dictionary value field name cannot be inferred by the default rule or the field name is different, the field() can be explicitly specified to indicate the dictionary value field name.
This annotation is typically used in conjunction with the Dict enum interface for uniformly managing the binding between dictionary values and display texts.
-
必需元素概要
所需元素 -
可选元素概要
可选元素
-
元素详细资料
-
value
Specifies an enumeration class to be used to translate dictionary values, which must implement theDictinterface.
-
-
-
field
String fieldSpecify the dictionary code field name, which is the name obtained by removing the "Desc" suffix from the field name of the current field.For example, if the field name is "orderStatusDesc", it corresponds to "orderStatus" by default. If the actual corresponding field name is different, you need to specify this attribute explicitly, otherwise the corresponding translation will not be found
- 默认值:
- ""
-