From ed876d0176b442c0a47dc8832bfe3d017647dc17 Mon Sep 17 00:00:00 2001 From: noear Date: Thu, 24 Feb 2022 21:04:37 +0800 Subject: [PATCH] 3.2.16 --- README.md | 2 +- README_en.md | 2 +- UPDATE_LOG.md | 3 +++ snack3/pom.xml | 2 +- .../java/org/noear/snack/core/exts/EnumWrap.java | 13 ++++++------- snack3_demo/pom.xml | 2 +- ...5_Snack3\347\232\204\344\275\277\347\224\250.md" | 2 +- ...\256\345\236\213JSON\346\241\206\346\236\266.md" | 2 +- ...\344\271\213Jsonpath\344\275\277\347\224\250.md" | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8a94e48a..8fffb4e9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ org.noear snack3 - 3.2.15 + 3.2.16 ``` diff --git a/README_en.md b/README_en.md index 00951f28..2c7e427b 100644 --- a/README_en.md +++ b/README_en.md @@ -12,7 +12,7 @@ Based on JDK8, 80Kb. Support: serialization and deserialization, parsing and tra org.noear snack3 - 3.2.15 + 3.2.16 ``` diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index 6d873305..14808f5c 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -1,3 +1,6 @@ +#### 3.2.16 +* 枚举支持字符大小写 + #### 3.2.14 * 增加字符串 "true" 转为 Boolean diff --git a/snack3/pom.xml b/snack3/pom.xml index 2e6baef9..80704634 100644 --- a/snack3/pom.xml +++ b/snack3/pom.xml @@ -6,7 +6,7 @@ org.noear snack3 - 3.2.15 + 3.2.16 jar ${project.artifactId} diff --git a/snack3/src/main/java/org/noear/snack/core/exts/EnumWrap.java b/snack3/src/main/java/org/noear/snack/core/exts/EnumWrap.java index e24896f0..d5e4eed0 100644 --- a/snack3/src/main/java/org/noear/snack/core/exts/EnumWrap.java +++ b/snack3/src/main/java/org/noear/snack/core/exts/EnumWrap.java @@ -8,24 +8,23 @@ * */ public class EnumWrap { protected final Map enumMap = new HashMap<>(); - protected final Enum[] enumOrdinal; + protected final Enum[] enumOrdinal; - public EnumWrap(Class enumClass){ + public EnumWrap(Class enumClass) { enumOrdinal = (Enum[]) enumClass.getEnumConstants(); for (int i = 0; i < enumOrdinal.length; ++i) { Enum e = enumOrdinal[i]; - String name = e.name(); - enumMap.put(name,e); + enumMap.put(e.name().toLowerCase(), e); } } - public Enum get(int ordinal){ + public Enum get(int ordinal) { return enumOrdinal[ordinal]; } - public Enum get(String name){ - return enumMap.get(name); + public Enum get(String name) { + return enumMap.get(name.toLowerCase()); } } diff --git a/snack3_demo/pom.xml b/snack3_demo/pom.xml index 7415f76a..070bb364 100644 --- a/snack3_demo/pom.xml +++ b/snack3_demo/pom.xml @@ -20,7 +20,7 @@ org.noear snack3 - 3.2.15 + 3.2.16 diff --git "a/\346\226\207\347\253\240_Java_\344\270\255_Snack3\347\232\204\344\275\277\347\224\250.md" "b/\346\226\207\347\253\240_Java_\344\270\255_Snack3\347\232\204\344\275\277\347\224\250.md" index 1d3360fe..3919e561 100644 --- "a/\346\226\207\347\253\240_Java_\344\270\255_Snack3\347\232\204\344\275\277\347\224\250.md" +++ "b/\346\226\207\347\253\240_Java_\344\270\255_Snack3\347\232\204\344\275\277\347\224\250.md" @@ -9,7 +9,7 @@ Snack3 基于jdk8,60kb大小,非常小巧。 org.noear snack3 - 3.2.15 + 3.2.16 ``` diff --git "a/\346\226\207\347\253\240_Snack3_\344\270\200\344\270\252\346\226\260\347\232\204\345\276\256\345\236\213JSON\346\241\206\346\236\266.md" "b/\346\226\207\347\253\240_Snack3_\344\270\200\344\270\252\346\226\260\347\232\204\345\276\256\345\236\213JSON\346\241\206\346\236\266.md" index f5469068..cc6b9d63 100644 --- "a/\346\226\207\347\253\240_Snack3_\344\270\200\344\270\252\346\226\260\347\232\204\345\276\256\345\236\213JSON\346\241\206\346\236\266.md" +++ "b/\346\226\207\347\253\240_Snack3_\344\270\200\344\270\252\346\226\260\347\232\204\345\276\256\345\236\213JSON\346\241\206\346\236\266.md" @@ -34,7 +34,7 @@ ONode 即 `One node` 之意;借签了 `Javascript` 所有变量由 `var` 申 org.noear snack3 - 3.2.15 + 3.2.16 ``` diff --git "a/\346\226\207\347\253\240_Snack3\344\271\213Jsonpath\344\275\277\347\224\250.md" "b/\346\226\207\347\253\240_Snack3\344\271\213Jsonpath\344\275\277\347\224\250.md" index 5d42e59a..af3042d7 100644 --- "a/\346\226\207\347\253\240_Snack3\344\271\213Jsonpath\344\275\277\347\224\250.md" +++ "b/\346\226\207\347\253\240_Snack3\344\271\213Jsonpath\344\275\277\347\224\250.md" @@ -9,7 +9,7 @@ Snack3 是一个支持JSONPath的JSON框架。JSONPath是一个很强大的功 org.noear snack3 - 3.2.15 + 3.2.16 ```