Package javax.el

Examples of javax.el.MethodInfo


            String t = expr.substring(idx + 1);
            String method = t.substring(0, (t.length() - 1));
           
            FacesContext context = FacesContext.getCurrentInstance();
            ELContext elContext = context.getELContext();
            MethodInfo controlInfo = expression.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
            Method[] methods = result.getClass().getMethods();
            for (Method meth : methods) {
                if (meth.getName().equals(method)
                     && meth.getReturnType().equals(controlInfo.getReturnType())
                     && Arrays.equals(meth.getParameterTypes(),
                                      controlInfo.getParamTypes())) {
                    return true;                     
                }
            }
        }
        return false;
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

      FacesContext facesContext = (FacesContext)
    context.getContext(FacesContext.class);
      if (null != facesContext) {
    try {
        //PENDING - we should find a way to provide more information
        info = new MethodInfo(null, binding.getType(facesContext), null);
    }
    catch (Exception e) {
        throw new ELException(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 = expression.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
            Method[] methods = result.getClass().getMethods();
            for (Method meth : methods) {
                if (meth.getName().equals(method)
                     && meth.getReturnType().equals(controlInfo.getReturnType())
                     && Arrays.equals(meth.getParameterTypes(),
                                      controlInfo.getParamTypes())) {
                    return true;                     
                }
            }
        }
        return false;
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

    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

            {
                methodInfo = invoke(new Invoker<MethodInfo>()
                {
                    public MethodInfo invoke()
                    {
                        return new MethodInfo(null, methodBinding.getType(facesContext), null);
                    }
                });
            }
        }
        return methodInfo;
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.