Used to set ordinal
as the default value when using @see with enum types.
This setting has lower priority than enum.use.custom](enum_use_custom.md) and enum.use.by.type. Therefore, to use enum.use.ordinal
, 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 ordinal
field:enum.use.ordinal[com.itangcent.common.constant.UserType]=true
/**
* User type
* @see UserType#ordinal()
*/
private int type;
name | type | required | default | desc | other |
---|---|---|---|---|---|
type | integer | optional | User type | Enum: 0, 1, 2Enum Remarks: 0: Administrator, 1: Member, 2: GuestMock: @pick([0, 1, 2]) |
package com.itangcent.common.constant;
public interface BaseEnum {
}
UserType
class to implement the BaseEnum
interface:public enum UserType implements BaseEnum {
...
}
BaseEnum
to use the ordinal
as the default value:enum.use.ordinal[groovy:it.isExtend("com.itangcent.common.constant.BaseEnum")]=true
ordinal
for all @see
with enum types in the entire projectenum.use.ordinal=true