Used to set name
as the value when using @see
with enum types.
This setting has lower priority than enum.use.custom and enum.use.by.type. Therefore, to use enum.use.name
, you need to first disable enum.use.by.type
in the recommended configuration.
Assuming the following enum class exists
public enum UserType {
// Administrator
ADMIN(1, "Administrator"),
// Member
MEMBER(2, "Member"),
// Guest
GUEST(3, "Guest");
private int code;
private String desc;
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
UserType(int code, String desc) {
this.code = code;
this.desc = desc;
}
}
For the following field:
/**
* User type
*
* @see UserType
*/
private int type;
@see UserType
in this case will be ignored.@see UserType
to use the name
field:enum.use.name[com.itangcent.common.constant.UserType]=true
/**
* User type
* @see UserType#name()
*/
private String type;
name | type | required | default | desc | other |
---|---|---|---|---|---|
type | string | Optional | User type | Enum: ADMIN, MEMBER, GUESTEnum Remarks: ADMIN: Administrator, MEMBER: Member, GUEST: GuestMock: @pick([ADMIN,MEMBER,GUEST]) |
package com.itangcent.common.constant;
public interface BaseEnum {
}
UserType
class to implement the BaseEnum
interface:public enum UserType implements BaseEnum {
...
}
BaseEnum
to use the name
field as the default value:enum.use.name[groovy:it.isExtend("com.itangcent.common.constant.BaseEnum")]=true
name
for all @see
with enum types in the entire projectenum.use.name=true