package com.thinkbig.lep.core;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
public class Main {
public static void main(String[] args) {
ExpressionParser parser = new SpelExpressionParser();
Expression exp = parser.parseExpression("add(10, 20)");
EvaluationContext context = new StandardEvaluationContext(new MyEvaluate());
Boolean result = exp.getValue(context, Boolean.class);
System.out.println(result);
}
}
class MyEvaluate {
public Boolean add(int a, int b) {
return true;
}
}