类 NkSpELManager

java.lang.Object
cn.nkpro.elcube.co.spel.NkSpELManager

@Component public class NkSpELManager extends Object
SpEL 表达式的管理类 负责传入一个对象来创建 EvaluationContext, 并执行SpEL
  • 构造器详细资料

    • NkSpELManager

      public NkSpELManager()
  • 方法详细资料

    • createContext

      public org.springframework.expression.EvaluationContext createContext(Object root)
    • invoke

      public Object invoke(String el, Object root)
    • invoke

      public void invoke(String el, Object value, org.springframework.expression.EvaluationContext context)
    • invoke

      public Object invoke(String el, org.springframework.expression.EvaluationContext context)
    • hasTemplate

      public boolean hasTemplate(String input)
    • convert

      public String convert(String input, Object root)
      为什么没有采用SpEL的Template的#{} 语法? 因为我们的目的是通过一个字符串模版生成一个JSON格式的内容,#{} 只能将表达式的返回值通过toString()的方式潜入到模版中, 这不是我要的效果 经过测试与TEMPLATE_EXPRESSION方式的对比,1000000次执行结果差距仅500ms,那么对一个单据业务来说影响微乎其微 Expression expression = parser.parseExpression(input, ParserContext.TEMPLATE_EXPRESSION);
    • convert

      public String convert(String input, org.springframework.expression.EvaluationContext context)
    • convert

      public String convert(String input, org.springframework.expression.EvaluationContext context, boolean statistics)
    • getSpELMap

      public Map<String,​Object> getSpELMap()