Package javax.el

Examples of javax.el.MethodInfo


    }
  }

  public Class getType(FacesContext facesContext)
  {
    MethodInfo mi = _me.getMethodInfo(facesContext.getELContext());
    if (mi == null)
      return null;

    return mi.getReturnType();
  }
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

            @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

    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

  @Override
  public MethodInfo getMethodInfo(ELContext context) {

    Method method = ExpressionInspector.getMethodReference(context, valueExpression).getMethod();

    return new MethodInfo(method.getName(), method.getReturnType(), method.getParameterTypes());
  }
View Full Code Here

  public MethodReference(Object base, Method method, Object[] actualParameters, boolean fromMethod) {
    this.base = base;
    this.method = method;
    this.actualParameters = (actualParameters != null) ? actualParameters : NO_PARAMS;
    this.fromMethod = fromMethod;
    methodInfo =  new MethodInfo(method.getName(), method.getReturnType(), method.getParameterTypes());
  }
View Full Code Here

   *            the method expression to be wrapped
   * @return a Method instance that when invoked causes the wrapped method expression to be invoked.
   */
  public static Method methodExpressionToStaticMethod(final ELContext context, final MethodExpression methodExpression) {

    MethodInfo methodInfo = methodExpression.getMethodInfo(getELContext());

    try {
      // Create a Method instance with the signature (return type, name, parameter types) corresponding
      // to the method the MethodExpression references.
      Constructor<Method> methodConstructor = Method.class.getDeclaredConstructor(Class.class,
        String.class, Class[].class, Class.class,
        Class[].class, int.class, int.class, String.class, byte[].class, byte[].class, byte[].class
      );
      methodConstructor.setAccessible(true);
      Method staticMethod = methodConstructor.newInstance(null,
        methodInfo.getName(), methodInfo.getParamTypes(), methodInfo.getReturnType(),
        null, 0, 0, null, null, null, null
      );

      // The Sun/Oracle/OpenJDK Method makes use of a private delegator called MethodAccessor.
      // Though specific to those JDKs, this is what we can use to let our Method instance execute something
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

        if ( context == null ) {
            throw new NullPointerException();
        }
       
  try {
      MethodInfo mi =
    methodExpression.getMethodInfo(context.getELContext());
      result = mi.getReturnType();
  }
  catch (javax.el.PropertyNotFoundException e) {
      throw new javax.faces.el.MethodNotFoundException(e);
  }
  catch (javax.el.MethodNotFoundException e) {
View Full Code Here

            String t = expr.substring(idx + 1);
            String method = t.substring(0, (t.length() - 1));
           
            FacesContext context = FacesContext.getCurrentInstance();
            ELContext elContext = context.getELContext();
            MethodInfo controlInfo = methodExpression.getMethodInfo(elContext);
           
            // ensure the method names are the same
            if (!controlInfo.getName().equals(method)) {
                return false;
            }
           
            // Using the target, create an expression and evaluate
            // it.          
            ExpressionFactory factory = context.getApplication().getExpressionFactory();
            ValueExpression ve = factory.createValueExpression(elContext,
                                                               "#{" + target + '}',
                                                               Object.class);
            if (ve == null) {
                return false;                                                              
            }
           
            Object result = ve.getValue(elContext);
           
            if (result == null) {
                return false;
            }
           
            // Get all of the methods with the matching name and try
            // to find a match based on controlInfo's return and parameter
            // types
            Class type = binding.getType(context);
            Method[] methods = result.getClass().getMethods();
            for (Method meth : methods) {
                if (meth.getName().equals(method)
                     && type.equals(controlInfo.getReturnType())
                     && Arrays.equals(meth.getParameterTypes(),
                                      controlInfo.getParamTypes())) {
                    return true;                     
                }
            }
        }
       
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.