本文整理匯總了Java中org.apache.ibatis.ognl.Ognl類的典型用法代碼示例。如果您正苦於以下問題:Java Ognl類的具體用法?Java Ognl怎麽用?Java Ognl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Ognl類屬於org.apache.ibatis.ognl包,在下文中一共展示了Ognl類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: touch
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
public static void touch(String result, ResultKey resultKey) {
Objects.requireNonNull(resultKey);
Objects.requireNonNull(result);
try {
JSONObject jsonObject = JSONObject.parseObject(result);
String value = (String) Ognl.getValue(resultKey.getOgnl(), jsonObject);
ThrushResult thrushResult = new ThrushResult(resultKey.getKey(), value);
Set<ThrushResult> thrushResults = Optional.ofNullable(resultManager.get()).orElse(new HashSet<>());
if (thrushResults.contains(thrushResult)) {
thrushResults.remove(thrushResult);
}
thrushResults.add(thrushResult);
resultManager.set(thrushResults);
} catch (OgnlException e) {
logger.error("ResultManager ognl error", e);
throw new RuntimeException(e);
}
}
示例2: mapNotNull
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
public Object[] mapNotNull(String sql_columns) {
String[] strings = this.strings.deleteWhitespace(sql_columns).split(",");
Map<String, String> mappings = new HashMap<>();
IntFunction<String> canonicalize = i -> {
String column = strings[i];
String property = this.strings.removeUnderscoreAndCamelize(column);
mappings.put(column, property);
return property;
};
Object[] properties = IntStream.range(0, strings.length)
.mapToObj(canonicalize)
.filter(property -> {
try {
return Ognl.getValue(property, root) != null;
} catch (OgnlException e) {
logger.error("Can't get value {}.{}", root, property);
}
return false;
}).toArray();
return mappings.entrySet().stream()
.filter(entry -> Arrays.stream(properties).anyMatch(entry.getValue()::equals)).toArray();
}
示例3: extract
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
public static String extract(String ognl, String json) throws OgnlException {
Objects.requireNonNull(json);
Objects.requireNonNull(ognl);
JSONObject jsonObject = JSONObject.parseObject(json);
Object value = Ognl.getValue(ognl, jsonObject);
return Optional.ofNullable(value).map(s -> s.toString()).orElse(StringUtils.EMPTY);
}
示例4: genParams
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
private void genParams(Invocation invocation, SplitRequest splitRequest) throws OgnlException {
Object[] params = new Object[splitRequest.getOgnl().length];
for (int i = 0; i < splitRequest.getOgnl().length; i++) {
params[i] = Ognl.getValue(splitRequest.getOgnl()[i], invocation.getArgs()[1]);
}
splitRequest.setParam(params);
}
示例5: test2
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
@Test
public void test2() throws OgnlException {
List<RuleNode> dataNodes = XmlDataContext.getContext().getNodes();
Map<String, RuleNode> map = new HashMap<>();
map.put("key1", dataNodes.get(0));
map.put("key2", dataNodes.get(1));
Object value = Ognl.getValue("key1.keyColumn.table", map);
System.out.println(value);
Object value2 = Ognl.getValue("key2.keyColumn.table", map);
System.out.println(value2);
}
示例6: test3
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
@Test
public void test3() throws OgnlException {
List<RuleNode> dataNodes = XmlDataContext.getContext().getNodes();
Map<String, List<RuleNode>> map = new HashMap<>();
map.put("key", dataNodes);
Object value = Ognl.getValue("key[1].keyColumn.table", map);
System.out.println(value);
}
示例7: test
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
@Test
public void test() throws OgnlException {
JSONObject jsonObject = JSONObject.parseObject("{\"result_message\":\"驗證通過\",\"result_code\":0,\"apptk\":null,\"newapptk\":\"3NXQt63mvUCRihvGv1gn9pM2WFtDXd0e0V5Wyt2_4NYSflEqrwe1e0\"}");
Object value = Ognl.getValue("newapptk", jsonObject);
System.out.println(value);
}
示例8: test
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
@Test
public void test() throws OgnlException {
List<RuleNode> dataNodes = XmlDataContext.getContext().getNodes();
Object value = Ognl.getValue("[0].keyColumn.table", dataNodes);
System.out.println(value);
}
示例9: test5
import org.apache.ibatis.ognl.Ognl; //導入依賴的package包/類
@Test
public void test5() throws OgnlException {
Object value = Ognl.getValue("value", "value");
System.out.println(value);
}