Package com.alibaba.citrus.expr

Examples of com.alibaba.citrus.expr.Expression


     *
     * @param expr 表达式字符串
     * @return 表达式
     */
    public Expression createExpression(final String expr) throws ExpressionParseException {
        final Expression jexlExpression;

        try {
            jexlExpression = new JexlExpression(engine.createExpression(expr));
        } catch (Exception e) {
            throw new ExpressionParseException(e);
        }

        if (isSupportContextVariables() && isValidContextVariableName(expr)) {
            return new ExpressionSupport() {
                /**
                 * 取得表达式字符串表示。
                 *
                 * @return 表达式字符串表示
                 */
                public String getExpressionText() {
                    return expr;
                }

                /**
                 * 在指定的上下文中计算表达式。
                 *
                 * @param context <code>ExpressionContext</code>上下文
                 * @return 表达式的计算结果
                 */
                public Object evaluate(ExpressionContext context) {
                    // 首先执行jexl表达式
                    Object value = jexlExpression.evaluate(context);

                    // 如果jexl表达式结果为null,则从context中直接取值
                    if (value == null) {
                        value = context.get(expr);
                    }
View Full Code Here


     *
     * @param expr ���ʽ�ַ���
     * @return ���ʽ
     */
    public Expression createExpression(final String expr) throws ExpressionParseException {
        final Expression jexlExpression;

        try {
            jexlExpression = new JexlExpression(engine.createExpression(expr));
        } catch (Exception e) {
            throw new ExpressionParseException(e);
        }

        if (isSupportContextVariables() && isValidContextVariableName(expr)) {
            return new ExpressionSupport() {
                /**
                 * ȡ�ñ��ʽ�ַ�����ʾ��
                 *
                 * @return ���ʽ�ַ�����ʾ
                 */
                public String getExpressionText() {
                    return expr;
                }

                /**
                 * ��ָ�����������м�����ʽ��
                 *
                 * @param context <code>ExpressionContext</code>������
                 * @return ���ʽ�ļ�����
                 */
                public Object evaluate(ExpressionContext context) {
                    // ����ִ��jexl���ʽ
                    Object value = jexlExpression.evaluate(context);

                    // ���jexl���ʽ���Ϊnull�����context��ֱ��ȡֵ
                    if (value == null) {
                        value = context.get(expr);
                    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.expr.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.