diff --git a/fizz-common/src/test/java/we/util/MapUtilTests.java b/fizz-common/src/test/java/we/util/MapUtilTests.java
index d0bf844..c0d3ce0 100644
--- a/fizz-common/src/test/java/we/util/MapUtilTests.java
+++ b/fizz-common/src/test/java/we/util/MapUtilTests.java
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2021 the original author or authors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package we.util;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -9,6 +26,11 @@ import java.util.Map;
import org.junit.jupiter.api.Test;
+/**
+ *
+ * @author Francis Dong
+ *
+ */
public class MapUtilTests {
diff --git a/fizz-core/src/main/java/we/fizz/input/PathMapping.java b/fizz-core/src/main/java/we/fizz/input/PathMapping.java
index 5db153d..ddc67be 100644
--- a/fizz-core/src/main/java/we/fizz/input/PathMapping.java
+++ b/fizz-core/src/main/java/we/fizz/input/PathMapping.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.noear.snack.ONode;
@@ -38,6 +39,9 @@ import we.util.MapUtil;
*/
public class PathMapping {
+ private static List typeList = Arrays.asList("Integer", "int", "Boolean", "boolean", "Float", "float",
+ "Double", "double", "String", "string", "Long", "long");
+
public static ONode toONode(Object obj) {
ONode o = null;
synchronized (obj) {
@@ -116,10 +120,10 @@ public class PathMapping {
for (Entry entry : rules.entrySet()) {
if (entry.getValue() instanceof String) {
String val = (String) entry.getValue();
- String[] vals = val.split(" ");
- if (vals.length > 1) {
- rs.put(entry.getKey(), vals[1]);
- types.put(entry.getKey(), vals[0]);
+ Optional optType = typeList.stream().filter(s -> val.startsWith(s + " ")).findFirst();
+ if (optType.isPresent()) {
+ rs.put(entry.getKey(), val.substring(optType.get().length() + 1));
+ types.put(entry.getKey(), optType.get());
} else {
rs.put(entry.getKey(), val);
}
@@ -160,7 +164,8 @@ public class PathMapping {
obj = val.val().isNull() ? null : val.val().getDouble();
break;
}
- case "String": {
+ case "String":
+ case "string": {
obj = val.val().isNull() ? null : val.val().getString();
break;
}
diff --git a/pom.xml b/pom.xml
index 55a3a52..837291c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -249,7 +249,7 @@
org.noear
snack3
- 3.1.6.4
+ 3.1.14