commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r391207 - in /jakarta/commons/proper/jexl/trunk/src: java/org/apache/commons/jexl/util/introspection/UberspectImpl.java test/org/apache/commons/jexl/JexlTest.java
Date Tue, 04 Apr 2006 01:13:24 GMT
Author: dion
Date: Mon Apr  3 18:13:22 2006
New Revision: 391207

URL: http://svn.apache.org/viewcvs?rev=391207&view=rev
Log:
Allow static methods to be executed on classes, e.g.
if the context contains: Boolean.class as 'variable', 
variable.valueOf('true') should work.

Modified:
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
    jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java?rev=391207&r1=391206&r2=391207&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.java
Mon Apr  3 18:13:22 2006
@@ -135,6 +135,9 @@
             return null;
 
         Method m = introspector.getMethod(obj.getClass(), methodName, args);
+        if (m == null && obj instanceof Class) {
+            m = introspector.getMethod((Class) obj, methodName, args);
+        }
 
         return (m == null) ? null : new VelMethodImpl(m);
     }

Modified: jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java?rev=391207&r1=391206&r2=391207&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java Mon Apr
 3 18:13:22 2006
@@ -855,6 +855,14 @@
         assertExpression(jc, "aBool.valueOf('true')", Boolean.TRUE);
     }
     
+    public void testStaticMethodInvocationOnClasses() throws Exception
+    {
+        JexlContext jc = JexlHelper.createContext();
+        jc.getVars().put("Boolean", Boolean.class);
+        assertExpression(jc, "Boolean.valueOf('true')", Boolean.TRUE);
+        
+    }
+    
     /**
      * Make sure bad syntax throws ParseException
      * @throws Exception on errors



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message