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


Java MethodNotFoundException类代码示例

本文整理汇总了Java中javax.el.MethodNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java MethodNotFoundException类的具体用法?Java MethodNotFoundException怎么用?Java MethodNotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: invokeTarget

import javax.el.MethodNotFoundException; //导入依赖的package包/类
private final Object invokeTarget(EvaluationContext ctx, Object target,
        Object[] paramValues) throws ELException {
    if (target instanceof MethodExpression) {
        MethodExpression me = (MethodExpression) target;
        return me.invoke(ctx.getELContext(), paramValues);
    } else if (target == null) {
        throw new MethodNotFoundException("Identity '" + this.image
                + "' was null and was unable to invoke");
    } else {
        throw new ELException(
                "Identity '"
                        + this.image
                        + "' does not reference a MethodExpression instance, returned type: "
                        + target.getClass().getName());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AstIdentifier.java

示例2: getMethod

import javax.el.MethodNotFoundException; //导入依赖的package包/类
/**
 * Returns a method based on the criteria
 * @param base the object that owns the method
 * @param property the name of the method
 * @param paramTypes the parameter types to use
 * @return the method specified
 * @throws MethodNotFoundException
 */
public static Method getMethod(Object base, Object property,
        Class[] paramTypes) throws MethodNotFoundException {
    if (base == null || property == null) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }

    String methodName = (property instanceof String) ? (String) property
            : property.toString();

    Method method = null;
    try {
        method = base.getClass().getMethod(methodName, paramTypes);
    } catch (NoSuchMethodException nsme) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }
    return method;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:ReflectionUtil.java

示例3: testEvaluate_lambda

import javax.el.MethodNotFoundException; //导入依赖的package包/类
/**
 * ラムダ式のテスト - EL2.xでは非さぽーとのため失敗する
 */
@Test(expected=ExpressionEvaluationException.class)
public void testEvaluate_lambda() {
    
    String expression = "sum=0;list.stream().forEach(x->(sum=sum+x));sum";
    
    Map<String, Object> vars = new HashMap<>();
    vars.put("list", Arrays.asList(1, 2, 3, 4, 5, 6));
    
    try {
        el.evaluate(expression, vars);
        fail();
        
    } catch(Exception e) {
        assertThat(e, is(instanceOf(ExpressionEvaluationException.class)));
        assertThat(e.getCause(), is(instanceOf(MethodNotFoundException.class)));
        
        throw e;
    }
    
}
 
开发者ID:mygreen,项目名称:xlsmapper,代码行数:24,代码来源:ExpressionLangaugeEL2ImplTest.java

示例4: findMethod

import javax.el.MethodNotFoundException; //导入依赖的package包/类
public static Method findMethod(Object base, Object name, Object[] params) {
        Method r = null;
        if (base != null && name != null) {
            Class type = base.getClass();
            String methodName = ELSupport.coerceToString(name);
            MethodCache m = methodCache.get(type);
//            if (m == null || type != m.getType()) {
//                m = new MethodCache(type);
//                methodCache.set(type, m);
//            }
            r = m.findMethod(methodName, params);
            if (r == null) {
                throw new MethodNotFoundException(MessageFactory.get(
                        "error.method.notfound", base, name,
                        paramString(paramTypes(params))));
            }
        } else {
            throw new MethodNotFoundException();
        }
        return r;
    }
 
开发者ID:seam2,项目名称:jboss-el,代码行数:22,代码来源:ReflectionUtil.java

示例5: getMethod

import javax.el.MethodNotFoundException; //导入依赖的package包/类
/**
 * Returns a method based on the criteria
 *
 * @param base
 *            the object that owns the method
 * @param property
 *            the name of the method
 * @param paramTypes
 *            the parameter types to use
 * @return the method specified
 * @throws MethodNotFoundException
 */
public static Method getMethod(Object base, Object property,
        Class[] paramTypes) throws MethodNotFoundException {
    if (base == null || property == null) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }
    
    String methodName = (property instanceof String) ? (String) property
            : property.toString();
    
    Method method = null;
    try {
        method = base.getClass().getMethod(methodName, paramTypes);
    } catch (NoSuchMethodException nsme) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }
    return method;
}
 
开发者ID:seam2,项目名称:jboss-el,代码行数:34,代码来源:ReflectionUtil.java

示例6: getMethodExpression

import javax.el.MethodNotFoundException; //导入依赖的package包/类
private final MethodExpression getMethodExpression(EvaluationContext ctx)
        throws ELException {
    Object obj = null;

    // case A: ValueExpression exists, getValue which must
    // be a MethodExpression
    VariableMapper varMapper = ctx.getVariableMapper();
    ValueExpression ve = null;
    if (varMapper != null) {
        ve = varMapper.resolveVariable(this.image);
        if (ve != null) {
            obj = ve.getValue(ctx);
        }
    }

    // case B: evaluate the identity against the ELResolver, again, must be
    // a MethodExpression to be able to invoke
    if (ve == null) {
        ctx.setPropertyResolved(false);
        obj = ctx.getELResolver().getValue(ctx, null, this.image);
    }

    // finally provide helpful hints
    if (obj instanceof MethodExpression) {
        return (MethodExpression) obj;
    } else if (obj == null) {
        throw new MethodNotFoundException("Identity '" + this.image
                + "' was null and was unable to invoke");
    } else {
        throw new ELException(
                "Identity '"
                        + this.image
                        + "' does not reference a MethodExpression instance, returned type: "
                        + obj.getClass().getName());
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:37,代码来源:AstIdentifier.java

示例7: getMethodExpression

import javax.el.MethodNotFoundException; //导入依赖的package包/类
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException {
	Object obj = null;

	// case A: ValueExpression exists, getValue which must
	// be a MethodExpression
	VariableMapper varMapper = ctx.getVariableMapper();
	ValueExpression ve = null;
	if (varMapper != null) {
		ve = varMapper.resolveVariable(this.image);
		if (ve != null) {
			obj = ve.getValue(ctx);
		}
	}

	// case B: evaluate the identity against the ELResolver, again, must be
	// a MethodExpression to be able to invoke
	if (ve == null) {
		ctx.setPropertyResolved(false);
		obj = ctx.getELResolver().getValue(ctx, null, this.image);
	}

	// finally provide helpful hints
	if (obj instanceof MethodExpression) {
		return (MethodExpression) obj;
	} else if (obj == null) {
		throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke");
	} else {
		throw new ELException("Identity '" + this.image
				+ "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName());
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:AstIdentifier.java

示例8: invoke

import javax.el.MethodNotFoundException; //导入依赖的package包/类
@Override
public Object invoke(final ELContext context, final Object base, final Object method,
    final Class<?>[] paramTypes, final Object[] params) {
  if (resolveType(base)) {
    if (isStrictMode) {
      throw new MethodNotFoundException();
    }
  }

  return null;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:12,代码来源:BuilderELResolver.java

示例9: findMethodOrThrow

import javax.el.MethodNotFoundException; //导入依赖的package包/类
protected Method findMethodOrThrow(final String methodName, final Class<?>[] paramTypes,
    final Object[] params, final boolean staticOnly, final MethodDescriptor[] methodDescriptors) {
  final Method method = findMethod(methodName, paramTypes, params, staticOnly, methodDescriptors);

  if (method == null) {
    throw new MethodNotFoundException("Method " + methodName + "for bean class "
        + "not found or accessible");
  }

  return method;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:12,代码来源:BeanELResolverEx.java

示例10: invoke

import javax.el.MethodNotFoundException; //导入依赖的package包/类
@Override
public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) {
  if (method == null || RESTRICTED_METHODS.contains(method.toString())) {
    throw new MethodNotFoundException("Cannot find method '" + method + "' in " + base.getClass());
  }
  return super.invoke(context, base, method, paramTypes, params);
}
 
开发者ID:HubSpot,项目名称:jinjava,代码行数:8,代码来源:JinjavaBeanELResolver.java

示例11: getMethodExpression

import javax.el.MethodNotFoundException; //导入依赖的package包/类
private final MethodExpression getMethodExpression(EvaluationContext ctx)
		throws ELException {
	Object obj = null;

	// case A: ValueExpression exists, getValue which must
	// be a MethodExpression
	VariableMapper varMapper = ctx.getVariableMapper();
	ValueExpression ve = null;
	if (varMapper != null) {
		ve = varMapper.resolveVariable(this.image);
		if (ve != null) {
			obj = ve.getValue(ctx);
		}
	}

	// case B: evaluate the identity against the ELResolver, again, must be
	// a MethodExpression to be able to invoke
	if (ve == null) {
		ctx.setPropertyResolved(false);
		obj = ctx.getELResolver().getValue(ctx, null, this.image);
	}

	// finally provide helpful hints
	if (obj instanceof MethodExpression) {
		return (MethodExpression) obj;
	} else if (obj == null) {
		throw new MethodNotFoundException("Identity '" + this.image
				+ "' was null and was unable to invoke");
	} else {
		throw new ELException(
				"Identity '"
						+ this.image
						+ "' does not reference a MethodExpression instance, returned type: "
						+ obj.getClass().getName());
	}
}
 
开发者ID:seam2,项目名称:jboss-el,代码行数:37,代码来源:AstIdentifier.java

示例12: JspMethodNotFoundException

import javax.el.MethodNotFoundException; //导入依赖的package包/类
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:4,代码来源:JspMethodNotFoundException.java

示例13: testBug54370a

import javax.el.MethodNotFoundException; //导入依赖的package包/类
@Test(expected=MethodNotFoundException.class)
public void testBug54370a() {
    ReflectionUtil.getMethod(BASE, "testA",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:TestReflectionUtil.java

示例14: testBug54370b

import javax.el.MethodNotFoundException; //导入依赖的package包/类
@Test(expected=MethodNotFoundException.class)
public void testBug54370b() {
    ReflectionUtil.getMethod(BASE, "testB",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:TestReflectionUtil.java

示例15: JspMethodNotFoundException

import javax.el.MethodNotFoundException; //导入依赖的package包/类
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
	super(mark + " " + e.getMessage(), e.getCause());
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:4,代码来源:JspMethodNotFoundException.java


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