Skip to content

Commit 18a60a9

Browse files
authored
Merge pull request #190 from github-ganyu/master
Optimize some code
2 parents 90f4088 + 1530864 commit 18a60a9

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

APIJSONORM/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dependency>
2323
<groupId>com.alibaba</groupId>
2424
<artifactId>fastjson</artifactId>
25-
<version>1.2.74</version>
25+
<version>1.2.75</version>
2626
</dependency>
2727
</dependencies>
2828

APIJSONORM/src/main/java/apijson/orm/AbstractParser.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,8 @@ public JSONObject getStructure(@NotNull String table, String method, String tag,
709709

710710
if (result != null) { // 加快下次查询,查到值的话组合情况其实是有限的,不属于恶意请求
711711
if (versionedMap == null) {
712-
versionedMap = new TreeMap<>(new Comparator<Integer>() {
713-
714-
@Override
715-
public int compare(Integer o1, Integer o2) {
716-
return o2 == null ? -1 : o2.compareTo(o1); // 降序
717-
}
712+
versionedMap = new TreeMap<>((o1, o2) -> {
713+
return o2 == null ? -1 : o2.compareTo(o1); // 降序
718714
});
719715
}
720716

APIJSONORM/src/main/java/apijson/orm/Logic.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,16 @@ public static int getType(char logicChar) {
108108
public static int getType(String logicChar) {
109109
int type = -1;
110110
if (logicChar != null && logicChar.length() == 1) {
111-
if ("|".equals(logicChar)) {
112-
type = 0;
113-
} else if ("&".equals(logicChar)) {
114-
type = 1;
115-
} else if ("!".equals(logicChar)) {
116-
type = 2;
111+
switch (logicChar) {
112+
case "|":
113+
type = 0;
114+
break;
115+
case "&":
116+
type = 1;
117+
break;
118+
case "!":
119+
type = 2;
120+
break;
117121
}
118122
}
119123
return type;

0 commit comments

Comments
 (0)