feat(JavaLangDoc): 2.14 java enum doc for Yes(1, "Yes") | java 枚举注释
This commit is contained in:
@@ -4,10 +4,12 @@ import io.github.linwancen.plugin.show.demo.java.obj.Anno;
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Child;
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Face;
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Parent;
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.YesOrNoEnum;
|
||||
|
||||
@Anno
|
||||
public class Ref implements Face {
|
||||
public static void method() {
|
||||
YesOrNoEnum enumDoc = YesOrNoEnum.YES;
|
||||
Parent noneNewMethod = new Call();
|
||||
Face noneNewDoc = new Ref();
|
||||
Child child = new Child(true);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.github.linwancen.plugin.show.demo.java.obj;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public enum YesOrNoEnum {
|
||||
YES("1", "是"),
|
||||
NO("0", "否"),
|
||||
;
|
||||
|
||||
public final String code;
|
||||
public final String desc;
|
||||
|
||||
YesOrNoEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return code + '-' + desc;
|
||||
}
|
||||
|
||||
private static final LinkedHashMap<String, YesOrNoEnum> map;
|
||||
|
||||
static {
|
||||
map = new LinkedHashMap<>();
|
||||
for (YesOrNoEnum value : values()) {
|
||||
map.put(value.code, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static YesOrNoEnum fromCode(String code) {
|
||||
return map.get(code);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user