Used to set the default value field when using
@see
enum types
Assuming the following enum class
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;
UserType
does not have a field named type, the @see UserType
will be ignored in the default case.code
field as the default value for @see UserType
, add the following configuration:enum.use.custom[com.itangcent.common.constant.UserType]=code
@see UserType
use the code
field as the default value./**
* User type
* @see UserType#code
*/
private int type;
name | type | required | default | desc | other |
---|---|---|---|---|---|
type | integer | Not Required | User Type | Enum: 1,2,3Enum Remark: 1 : Administrator 2 : Member 3 : GuestMock: @pick([1,2,3]) |
package com.itangcent.common.constant;
public interface BaseEnum {
Long getCode();
}
UserType
to inherit BaseEnum
:public enum UserType implements BaseEnum {
...
}
code
field as the default value for all classes that inherit BaseEnum
:enum.use.custom[groovy:it.isExtend("com.itangcent.common.constant.BaseEnum")]=code