Package javax.el

Examples of javax.el.MethodInfo


    assertEquals(1l, parseNode("${base['bar']}").invoke(bindings, context, long.class, new Class[0], null));
    assertEquals(2l, parseNode("${base['bar']}").invoke(bindings, context, null, new Class[]{long.class}, new Object[]{2l}));
  }

  public void testGetMethodInfo() {
    MethodInfo info = null;
   
    // long bar()
    info = parseNode("${base['bar']}").getMethodInfo(bindings, context, long.class, new Class[0]);
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());
   
    // long bar(long)
    info = parseNode("${base['bar']}").getMethodInfo(bindings, context, null, new Class[]{long.class});
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[]{long.class}, info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());

    // bad arg type
    try { info = parseNode("${base['bar']}").getMethodInfo(bindings, context, null, new Class[]{String.class}); fail(); } catch(ELException e) {}
    // bad return type
    try { info = parseNode("${base['bar']}").getMethodInfo(bindings, context, String.class, new Class[0]); fail(); } catch(ELException e) {}
View Full Code Here


    assertEquals(1l, parseNode("${base.bar}").invoke(bindings, context, long.class, new Class[0], null));
    assertEquals(2l, parseNode("${base.bar}").invoke(bindings, context, null, new Class[]{long.class}, new Object[]{2l}));
  }

  public void testGetMethodInfo() {
    MethodInfo info = null;
   
    // long bar()
    info = parseNode("${base.bar}").getMethodInfo(bindings, context, long.class, new Class[0]);
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());
   
    // long bar(long)
    info = parseNode("${base.bar}").getMethodInfo(bindings, context, null, new Class[]{long.class});
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[]{long.class}, info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());

    // bad arg type
    try { info = parseNode("${base.bar}").getMethodInfo(bindings, context, null, new Class[]{String.class}); fail(); } catch(ELException e) {}
    // bad return type
    try { info = parseNode("${base.bar}").getMethodInfo(bindings, context, String.class, new Class[0]); fail(); } catch(ELException e) {}
View Full Code Here

    assertEquals(1l, parseNode("${base['bar']}").invoke(bindings, context, long.class, new Class[0], null));
    assertEquals(2l, parseNode("${base['bar']}").invoke(bindings, context, null, new Class[]{long.class}, new Object[]{2l}));
  }

  public void testGetMethodInfo() {
    MethodInfo info = null;
   
    // long bar()
    info = parseNode("${base['bar']}").getMethodInfo(bindings, context, long.class, new Class[0]);
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());
   
    // long bar(long)
    info = parseNode("${base['bar']}").getMethodInfo(bindings, context, null, new Class[]{long.class});
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[]{long.class}, info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());

    // bad arg type
    try { info = parseNode("${base['bar']}").getMethodInfo(bindings, context, null, new Class[]{String.class}); fail(); } catch(ELException e) {}
    // bad return type
    try { info = parseNode("${base['bar']}").getMethodInfo(bindings, context, String.class, new Class[0]); fail(); } catch(ELException e) {}
View Full Code Here

    assertEquals(1l, parseNode("${base.bar}").invoke(bindings, context, long.class, new Class[0], null));
    assertEquals(2l, parseNode("${base.bar}").invoke(bindings, context, null, new Class[]{long.class}, new Object[]{2l}));
  }

  public void testGetMethodInfo() {
    MethodInfo info = null;
   
    // long bar()
    info = parseNode("${base.bar}").getMethodInfo(bindings, context, long.class, new Class[0]);
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[0], info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());
   
    // long bar(long)
    info = parseNode("${base.bar}").getMethodInfo(bindings, context, null, new Class[]{long.class});
    assertEquals("bar", info.getName());
    assertTrue(Arrays.equals(new Class[]{long.class}, info.getParamTypes()));
    assertEquals(long.class, info.getReturnType());

    // bad arg type
    try { info = parseNode("${base.bar}").getMethodInfo(bindings, context, null, new Class[]{String.class}); fail(); } catch(ELException e) {}
    // bad return type
    try { info = parseNode("${base.bar}").getMethodInfo(bindings, context, String.class, new Class[0]); fail(); } catch(ELException e) {}
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

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

    if (methodInfo == null) {
      final FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
      if (facesContext != null) {
        methodInfo = invoke(new Invoker<MethodInfo>() {
          public MethodInfo invoke() {
            return new MethodInfo(null, methodBinding.getType(facesContext), null);
          }
        });
      }
    }
    return methodInfo;
View Full Code Here

  }
  public void processAction(ActionEvent event)
      throws AbortProcessingException {
    ActionSource2 actionSource = (ActionSource2)event.getComponent();
    ELContext context = FacesContext.getCurrentInstance().getELContext();
    MethodInfo methodInfo = actionSource.getActionExpression().getMethodInfo(context);
    System.out.println("1 DebugActionListener::" + methodInfo.getName());
    nextActionListener.processAction(event);
    System.out.println("2 DebugActionListener::" + methodInfo.getName());
  }
View Full Code Here

            @SuppressWarnings("rawtypes") Class[] paramTypes)
            throws ELException {
        Target t = getTarget(ctx);
        Method m = ReflectionUtil.getMethod(
                t.base, t.property, paramTypes, null);
        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

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.