Package javax.el

Examples of javax.el.MethodInfo


    public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
            throws ELException {
        Target t = getTarget(ctx);
        Method m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);
        return new MethodInfo(m.getName(), m.getReturnType(), m
                .getParameterTypes());
    }
View Full Code Here


    public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes)
            throws ELException {
        Target t = getTarget(ctx);
        Method m = ReflectionUtil.getMethod(t.base, t.property, paramTypes);
        return new MethodInfo(m.getName(), m.getReturnType(), m
                .getParameterTypes());
    }
View Full Code Here

    {
        _MethodBindingToMethodExpression testimpl = new _MethodBindingToMethodExpression(_methodBinding);
        Class<Date> expectedReturnType = Date.class;
        expect(_methodBinding.getType(same(_facesContext))).andReturn(expectedReturnType);
        _mocksControl.replay();
        MethodInfo methodInfo = testimpl.getMethodInfo(_elContext);
        assertNotNull(methodInfo);
        // assertNull(methodInfo.getName());
        assertEquals(expectedReturnType, methodInfo.getReturnType());
        // assertNull(methodInfo.getParamTypes());
        _mocksControl.verify();
        _mocksControl.reset();

        assertGetMethodInfoException(MethodNotFoundException.class, new javax.faces.el.MethodNotFoundException());
View Full Code Here

    assertTrue(new TreeMethodExpression(store, null, null, null, "#{foo}", null, new Class[0]).isDeferred());
  }

  public void testGetMethodInfo() {
    TreeMethodExpression e = new TreeMethodExpression(store, null, null, null, "${base.foo}", null, new Class[0]);
    MethodInfo info = e.getMethodInfo(context);
    assertEquals("foo", info.getName());
    assertEquals(0, info.getParamTypes().length);
    assertEquals(int.class, info.getReturnType());
  }
View Full Code Here

    if (property == null && strict) {
      throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base));
    }
    String name = bindings.convert(property, String.class);
    Method method = findMethod(name, base.getClass(), returnType, paramTypes);
    return new MethodInfo(method.getName(), method.getReturnType(), paramTypes);
  }
View Full Code Here

    throw new MethodNotFoundException(LocalMessages.get("error.identifier.method.notamethod", name, value.getClass()));
  }

  public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) {
    Method method = getMethod(bindings, context, returnType, paramTypes);
    return new MethodInfo(method.getName(), method.getReturnType(), paramTypes);
  }
View Full Code Here

        this.paramTypes = paramTypes;
    }

    @Override
    public MethodInfo getMethodInfo(ELContext context) throws ELException {
        return new MethodInfo(this.expr, this.expectedType, this.paramTypes);
    }
View Full Code Here

  }

  public void testGetMethodInfo() {
    Tree tree = null;
    Bindings bindings = null;
    MethodInfo info = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    try { getNode(tree).getMethodInfo(bindings, context, long.class, new Class[0]); fail(); } catch (ELException e) {}
   
    tree = parse("${var_method_1}");
    bindings = tree.bind(null, context.getVariableMapper());
    info = getNode(tree).getMethodInfo(bindings, context, long.class, new Class[0]);
    assertEquals("method_1", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());
   
    tree = parse("${property_method_1}");
    bindings = tree.bind(null, context.getVariableMapper());
    info = getNode(tree).getMethodInfo(bindings, context, long.class, new Class[0]);
    assertEquals("method_1", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());

    // no return type - ok
    info = getNode(tree).getMethodInfo(bindings, context, null, new Class[0]);
    assertEquals("method_1", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());
    // bad return type
    try { getNode(tree).getMethodInfo(bindings, context, int.class, new Class[0]); fail(); } catch (ELException e) {}
    // bad arg types
    try { getNode(tree).getMethodInfo(bindings, context, long.class, new Class[]{String.class}); fail(); } catch (ELException e) {}
  }
View Full Code Here

    if (property == null && strict) {
      throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base));
    }
    String name = TypeConversions.coerceToString(property);
    Method method = findMethod(name, base.getClass(), returnType, paramTypes);
    return new MethodInfo(method.getName(), method.getReturnType(), paramTypes);
  }
View Full Code Here

    throw new MethodNotFoundException(LocalMessages.get("error.identifier.method.notamethod", name, value.getClass()));
  }

  public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) {
    Method method = getMethod(bindings, context, returnType, paramTypes);
    return new MethodInfo(method.getName(), method.getReturnType(), paramTypes);
  }
View Full Code Here

TOP

Related Classes of javax.el.MethodInfo

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.