📄 evals.java
字号:
/* Evals.java{{IS_NOTE Purpose: Description: History: Wed Oct 27 17:47:03 2004, Created by tomyeh}}IS_NOTECopyright (C) 2004 Potix Corporation. All Rights Reserved.{{IS_RIGHT This program is distributed under GPL Version 2.0 in the hope that it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.el;import javax.servlet.jsp.el.ExpressionEvaluator;import javax.servlet.jsp.el.VariableResolver;import javax.servlet.jsp.el.FunctionMapper;import javax.servlet.jsp.el.ELException;import org.zkoss.lang.Classes;/** * Utilities to wrap the real implementation of Expression Language evaluators. * * @author tomyeh */public class Evals { protected Evals() {}//prevent from instantiate /** Evaluates the expression with the specified resolver and * mapper, and the expected class is Object.class. * * <p>Unlike ExpressionEvaluator, null is returned if expr is null. * * @param expr the expression, which might contain zero, one or * multiple ${...}. */ public static Object evaluate(String expr, Class expectedType, VariableResolver resolv, FunctionMapper funcs) throws ELException { if (expr == null || expr.length() == 0 || expr.indexOf("${") < 0) { if (expectedType == Object.class || expectedType == String.class) return expr; return Classes.coerce(expectedType, expr); } return new EvaluatorImpl().evaluate(expr, expectedType, resolv, funcs); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -