Skip to main content

[el-spec commits] [el-spec~source-code:61] Add changes inadvertently removed.

  • From: kchung@...
  • To: commits@...
  • Subject: [el-spec commits] [el-spec~source-code:61] Add changes inadvertently removed.
  • Date: Fri, 23 Mar 2012 18:28:17 +0000

Project:    el-spec
Repository: source-code
Revision:   61
Author:     kchung
Date:       2012-03-23 18:28:15 UTC
Link:       

Log Message:
------------
Add changes inadvertently removed.



Revisions:
----------
61


Modified Paths:
---------------
trunk/api/src/main/java/javax/el/BeanELResolver.java


Diffs:
------
Index: trunk/api/src/main/java/javax/el/BeanELResolver.java
===================================================================
--- trunk/api/src/main/java/javax/el/BeanELResolver.java        (revision 60)
+++ trunk/api/src/main/java/javax/el/BeanELResolver.java        (revision 61)
@@ -179,7 +179,7 @@
     /*
      * Defines a property for a bean.
      */
-    protected final static class BeanProperty {
+    final static class BeanProperty {
 
         private Method readMethod;
         private Method writeMethod;
@@ -212,7 +212,7 @@
     /*
      * Defines the properties for a bean.
      */
-    protected final static class BeanProperties {
+    final static class BeanProperties {
 
         private final Map<String, BeanProperty> propertyMap =
             new HashMap<String, BeanProperty>();
@@ -524,8 +524,9 @@
         if (base == null || method == null) {
             return null;
         }
-        Method m = findMethod(base, method.toString(), paramTypes, params);
-        Object ret = invokeMethod(m, base, params);
+        Method m = ELUtil.findMethod(base.getClass(), method.toString(),
+                                    paramTypes,params, false);
+        Object ret = ELUtil.invokeMethod(m, base, params);
         context.setPropertyResolved(true);
         return ret;
     }
@@ -727,61 +728,5 @@
         }
         return bp;
     }
-
-    private Method findMethod(Object base, String method,
-                              Class<?>[] paramTypes, Object[] params) {
-
-        Class<?>beanClass = base.getClass();
-        if (paramTypes != null) {
-            try {
-                return beanClass.getMethod(method, paramTypes);
-            } catch (java.lang.NoSuchMethodException ex) {
-                throw new MethodNotFoundException(ex);
-            }
-        }
-
-        int paramCount = (params == null)? 0: params.length;
-        for (Method m: base.getClass().getMethods()) {
-            if (m.getName().equals(method) && (
-                         m.isVarArgs() ||
-                         m.getParameterTypes().length==paramCount)){
-                return m;
-            }
-        }
-        throw new MethodNotFoundException("Method " + method + " not found");
-    }
-
-    static private ExpressionFactory expressionFactory;
-    static private ExpressionFactory getExpressionFactory() {
-        if (expressionFactory == null) {
-            expressionFactory = ExpressionFactory.newInstance();
-        }
-        return expressionFactory;
-    }
-
-    private Object invokeMethod(Method m, Object base, Object[] params) {
-
-        Class[] parameterTypes = m.getParameterTypes();
-        Object[] parameters = null;
-        if (parameterTypes.length > 0) {
-            ExpressionFactory exprFactory = getExpressionFactory();
-            if (m.isVarArgs()) {
-                // TODO
-            } else {
-                parameters = new Object[parameterTypes.length];
-                for (int i = 0; i < parameterTypes.length; i++) {
-                    parameters[i] = exprFactory.coerceToType(params[i],
-                                                           
parameterTypes[i]);
-                }
-            }
-        }
-        try {
-            return m.invoke(base, parameters);
-        } catch (IllegalAccessException iae) {
-            throw new ELException(iae);
-        } catch (InvocationTargetException ite) {
-            throw new ELException(ite.getCause());
-        }
-    }
 }
 





[el-spec commits] [el-spec~source-code:61] Add changes inadvertently removed.

kchung 03/23/2012
 
 
Close
loading
Please Confirm
Close