当前位置: 首页>>代码示例>>Java>>正文


Java ELResolver.invoke方法代码示例

本文整理汇总了Java中javax.el.ELResolver.invoke方法的典型用法代码示例。如果您正苦于以下问题:Java ELResolver.invoke方法的具体用法?Java ELResolver.invoke怎么用?Java ELResolver.invoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.el.ELResolver的用法示例。


在下文中一共展示了ELResolver.invoke方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import javax.el.ELResolver; //导入方法依赖的package包/类
@Override
public Object getValue(EvaluationContext ctx) throws ELException {
    Object base = this.children[0].getValue(ctx);
    int propCount = this.jjtGetNumChildren();
    int i = 1;
    Object suffix = null;
    ELResolver resolver = ctx.getELResolver();
    while (base != null && i < propCount) {
        suffix = this.children[i].getValue(ctx);
        if (i + 1 < propCount &&
                (this.children[i+1] instanceof AstMethodParameters)) {
            AstMethodParameters mps =
                (AstMethodParameters) this.children[i+1];
            // This is a method
            Object[] paramValues = mps.getParameters(ctx);
            base = resolver.invoke(ctx, base, suffix,
                    getTypesFromValues(paramValues), paramValues);
            i+=2;
        } else {
            // This is a property
            if (suffix == null) {
                return null;
            }
            
            ctx.setPropertyResolved(false);
            base = resolver.getValue(ctx, base, suffix);
            i++;
        }
    }
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled", base, suffix));            
    }
    return base;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:36,代码来源:AstValue.java

示例2: getValue

import javax.el.ELResolver; //导入方法依赖的package包/类
@Override
public Object getValue(EvaluationContext ctx) throws ELException {
	Object base = this.children[0].getValue(ctx);
	int propCount = this.jjtGetNumChildren();
	int i = 1;
	Object suffix = null;
	ELResolver resolver = ctx.getELResolver();
	while (base != null && i < propCount) {
		suffix = this.children[i].getValue(ctx);
		if (i + 1 < propCount && (this.children[i + 1] instanceof AstMethodParameters)) {
			AstMethodParameters mps = (AstMethodParameters) this.children[i + 1];
			// This is a method
			Object[] paramValues = mps.getParameters(ctx);
			base = resolver.invoke(ctx, base, suffix, getTypesFromValues(paramValues), paramValues);
			i += 2;
		} else {
			// This is a property
			if (suffix == null) {
				return null;
			}

			ctx.setPropertyResolved(false);
			base = resolver.getValue(ctx, base, suffix);
			i++;
		}
	}
	if (!ctx.isPropertyResolved()) {
		throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled", base, suffix));
	}
	return base;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:AstValue.java

示例3: getValue

import javax.el.ELResolver; //导入方法依赖的package包/类
@Override
public Object getValue(EvaluationContext ctx) throws ELException {
    Object base = this.children[0].getValue(ctx);
    int propCount = this.jjtGetNumChildren();
    int i = 1;
    Object suffix = null;
    ELResolver resolver = ctx.getELResolver();
    while (base != null && i < propCount) {
        suffix = this.children[i].getValue(ctx);
        if (i + 1 < propCount &&
                (this.children[i+1] instanceof AstMethodParameters)) {
            AstMethodParameters mps =
                (AstMethodParameters) this.children[i+1];
            // This is a method
            base = resolver.invoke(ctx, base, suffix, null,
                    mps.getParameters(ctx));
            i+=2;
        } else {
            // This is a property
            if (suffix == null) {
                return null;
            }
            
            ctx.setPropertyResolved(false);
            base = resolver.getValue(ctx, base, suffix);
            i++;
        }
    }
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled", base, suffix));            
    }
    return base;
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:35,代码来源:AstValue.java

示例4: getTarget

import javax.el.ELResolver; //导入方法依赖的package包/类
private final Target getTarget(EvaluationContext ctx) throws ELException {
    // evaluate expr-a to value-a
    Object base = this.children[0].getValue(ctx);

    // if our base is null (we know there are more properties to evaluate)
    if (base == null) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.unreachable.base", this.children[0].getImage()));
    }

    // set up our start/end
    Object property = null;
    int propCount = this.jjtGetNumChildren();
    
    int i = 1;
    // Evaluate any properties or methods before our target
    ELResolver resolver = ctx.getELResolver();
    while (i < propCount) {
        if (i + 2 < propCount &&
                this.children[i + 1] instanceof AstMethodParameters) {
            // Method call not at end of expression
            base = resolver.invoke(ctx, base,
                    this.children[i].getValue(ctx), null,
                    ((AstMethodParameters)
                            this.children[i + 1]).getParameters(ctx));
            i += 2;
        } else if (i + 2 == propCount &&
                this.children[i + 1] instanceof AstMethodParameters) {
            // Method call at end of expression
            ctx.setPropertyResolved(false);
            property = this.children[i].getValue(ctx);
            i += 2;

            if (property == null) {
                throw new PropertyNotFoundException(MessageFactory.get(
                        "error.unreachable.property", property));
            }
        } else if (i + 1 < propCount) {
            // Object with property not at end of expression
            property = this.children[i].getValue(ctx);
            ctx.setPropertyResolved(false);
            base = resolver.getValue(ctx, base, property);
            i++;

        } else {
            // Object with property at end of expression
            ctx.setPropertyResolved(false);
            property = this.children[i].getValue(ctx);
            i++;

            if (property == null) {
                throw new PropertyNotFoundException(MessageFactory.get(
                        "error.unreachable.property", property));
            }
        }
        if (base == null) {
            throw new PropertyNotFoundException(MessageFactory.get(
                    "error.unreachable.property", property));
        }
    }

    Target t = new Target();
    t.base = base;
    t.property = property;
    return t;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:67,代码来源:AstValue.java

示例5: getTarget

import javax.el.ELResolver; //导入方法依赖的package包/类
private final Target getTarget(EvaluationContext ctx) throws ELException {
	// evaluate expr-a to value-a
	Object base = this.children[0].getValue(ctx);

	// if our base is null (we know there are more properties to evaluate)
	if (base == null) {
		throw new PropertyNotFoundException(
				MessageFactory.get("error.unreachable.base", this.children[0].getImage()));
	}

	// set up our start/end
	Object property = null;
	int propCount = this.jjtGetNumChildren();

	int i = 1;
	// Evaluate any properties or methods before our target
	ELResolver resolver = ctx.getELResolver();
	while (i < propCount) {
		if (i + 2 < propCount && this.children[i + 1] instanceof AstMethodParameters) {
			// Method call not at end of expression
			base = resolver.invoke(ctx, base, this.children[i].getValue(ctx), null,
					((AstMethodParameters) this.children[i + 1]).getParameters(ctx));
			i += 2;
		} else if (i + 2 == propCount && this.children[i + 1] instanceof AstMethodParameters) {
			// Method call at end of expression
			ctx.setPropertyResolved(false);
			property = this.children[i].getValue(ctx);
			i += 2;

			if (property == null) {
				throw new PropertyNotFoundException(MessageFactory.get("error.unreachable.property", property));
			}
		} else if (i + 1 < propCount) {
			// Object with property not at end of expression
			property = this.children[i].getValue(ctx);
			ctx.setPropertyResolved(false);
			base = resolver.getValue(ctx, base, property);
			i++;

		} else {
			// Object with property at end of expression
			ctx.setPropertyResolved(false);
			property = this.children[i].getValue(ctx);
			i++;

			if (property == null) {
				throw new PropertyNotFoundException(MessageFactory.get("error.unreachable.property", property));
			}
		}
		if (base == null) {
			throw new PropertyNotFoundException(MessageFactory.get("error.unreachable.property", property));
		}
	}

	Target t = new Target();
	t.base = base;
	t.property = property;
	return t;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:60,代码来源:AstValue.java


注:本文中的javax.el.ELResolver.invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。