本文整理匯總了Java中org.mozilla.javascript.Context.toBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.toBoolean方法的具體用法?Java Context.toBoolean怎麽用?Java Context.toBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mozilla.javascript.Context
的用法示例。
在下文中一共展示了Context.toBoolean方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addCandidate
import org.mozilla.javascript.Context; //導入方法依賴的package包/類
private void addCandidate(Context js_context, JSONArray result) {
if (candidate != null) {
if (js_filter != null) {
try {
Scriptable scope = js_context.initStandardObjects(null, true);
scope.put("category", scope, candidate.getString(0));
scope.put("time", scope, candidate.getString(1));
scope.put("level", scope, candidate.getString(2));
scope.put("thread", scope, candidate.getString(3));
scope.put("message", scope, candidate.getString(4));
StringBuffer extra = new StringBuffer();
for (int i = 5; i < candidate.length(); i++) {
String sub_extra = candidate.getString(i);
extra.append(sub_extra).append(' ');
delim_extra.reset(sub_extra);
if (delim_extra.matches() && delim_extra.groupCount() == 2) {
scope.put(delim_extra.group(1), scope, delim_extra.group(2));
}
}
if (extra.length() > 0) {
scope.put("extra", scope, extra.substring(0, extra.length() - 1));
}
scope.setParentScope(js_utils);
if (Context.toBoolean(js_filter.exec(js_context, scope))) {
result.put(candidate);
}
} catch (Exception e) {
// TODO: handle exception
}
} else {
result.put(candidate);
}
candidate = null;
}
}