diff --git a/nop-xlang/src/main/java/io/nop/xlang/xmeta/ObjPropKind.java b/nop-xlang/src/main/java/io/nop/xlang/xmeta/ObjPropKind.java index d6f2b58d6576766d3d8313096756b4ad5605b7fd..b01bcb9e5d1c20b7a11a83ec72105ea5e4c5df32 100644 --- a/nop-xlang/src/main/java/io/nop/xlang/xmeta/ObjPropKind.java +++ b/nop-xlang/src/main/java/io/nop/xlang/xmeta/ObjPropKind.java @@ -10,6 +10,8 @@ package io.nop.xlang.xmeta; import io.nop.api.core.annotations.core.Label; import io.nop.api.core.annotations.core.Locale; import io.nop.api.core.annotations.core.Option; +import java.util.HashMap; +import java.util.Map; @Locale("zh-CN") public enum ObjPropKind { @@ -35,4 +37,16 @@ public enum ObjPropKind { public String toString() { return text; } + + private static final Map KIND_MAP = new HashMap<>(); + + static { + for (ObjPropKind kind : ObjPropKind.values()) { + KIND_MAP.put(kind.text, kind); + } + } + + public static ObjPropKind fromText(String text) { + return KIND_MAP.get(text); + } }