Skip to content

Commit 47439d1

Browse files
committed
远程函数:新增支持从当前请求的全局对象及 Parser 全局缓存取参数值
1 parent d92ab71 commit 47439d1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

APIJSONORM/src/main/java/apijson/Log.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class Log {
1414

1515
public static boolean DEBUG = true;
1616

17-
public static final String VERSION = "6.1.0";
17+
public static final String VERSION = "6.2.1";
1818
public static final String KEY_SYSTEM_INFO_DIVIDER = "\n---|-----APIJSON SYSTEM INFO-----|---\n";
1919

2020
public static final String OS_NAME;

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,22 @@ public AbstractFunctionParser setCurrentObject(@NotNull JSONObject currentObject
162162
* @param <T>
163163
*/
164164
public <T extends Object> T getArgVal(String path) {
165-
return getArgVal(getCurrentObject(), path);
165+
return getArgVal(path, false);
166+
}
167+
/**根据路径取值
168+
* @param path
169+
* @param tryAll false-仅当前对象,true-本次请求的全局对象以及 Parser 缓存值
170+
* @return
171+
* @param <T>
172+
*/
173+
public <T extends Object> T getArgVal(String path, boolean tryAll) {
174+
T val = getArgVal(getCurrentObject(), path);
175+
if (tryAll == false || val != null) {
176+
return val;
177+
}
178+
179+
Parser<?> p = getParser();
180+
return p == null ? null : (T) p.getValueByPath(path);
166181
}
167182
/**根据路径从对象 obj 中取值
168183
* @param obj

0 commit comments

Comments
 (0)