类org.springframework.expression.common.TemplateAwareExpressionParser源码实例Demo

下面列出了怎么用org.springframework.expression.common.TemplateAwareExpressionParser的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Android_Code_Arbiter   文件: SpelSample.java
public static void parseTemplateAwareExpression(String property) {

        TemplateAwareExpressionParser parser = new SpelExpressionParser();

        //Static value not that useful .. but safe
        Expression exp1 = parser.parseExpression("'safe expression'");
        String constantValue = exp1.getValue(String.class);
        System.out.println("exp1="+constantValue);

        StandardEvaluationContext testContext = new StandardEvaluationContext(TEST_PERSON);
        //Unsafe if the input is control by the user..
        Expression exp2 = parser.parseExpression(property+" == 'Benoit'");
        String dynamicValue = exp2.getValue(testContext, String.class);
        System.out.println("exp2="+dynamicValue);
    }
 
 类方法
 同包方法