當前位置: 首頁>>代碼示例>>Java>>正文


Java Ognl類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:justice-code,項目名稱:Thrush,代碼行數:23,代碼來源:ResultManager.java

示例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();
}
 
開發者ID:dantesun,項目名稱:webapp-boilerplate,代碼行數:23,代碼來源:ParameterObjectUtils.java

示例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);
}
 
開發者ID:justice-code,項目名稱:Thrush,代碼行數:10,代碼來源:JsonUtil.java

示例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);
}
 
開發者ID:justice-code,項目名稱:QiuQiu,代碼行數:8,代碼來源:SplitTableInterceptor.java

示例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);
}
 
開發者ID:justice-code,項目名稱:QiuQiu,代碼行數:13,代碼來源:OgnlTest.java

示例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);

}
 
開發者ID:justice-code,項目名稱:QiuQiu,代碼行數:10,代碼來源:OgnlTest.java

示例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);
}
 
開發者ID:justice-code,項目名稱:Thrush,代碼行數:7,代碼來源:OgnlTest.java

示例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);
}
 
開發者ID:justice-code,項目名稱:QiuQiu,代碼行數:7,代碼來源:OgnlTest.java

示例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);
}
 
開發者ID:justice-code,項目名稱:QiuQiu,代碼行數:6,代碼來源:OgnlTest.java


注:本文中的org.apache.ibatis.ognl.Ognl類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。