commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22193] - Unable to reference statics
Date Wed, 22 Sep 2004 17:11:00 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=22193>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=22193

Unable to reference statics





------- Additional Comments From guido.anzuoni@kyneste.com  2004-09-22 17:10 -------
I have verified a possible solution modifying
org.apache.commons.jexl.util.introspection.UberspectImpl

    public VelMethod getMethod(Object obj, String methodName, Object[] args, 
Info i)
            throws Exception
    {
        if (obj == null)
            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) ? new VelMethodImpl(m) : null;
    }


In this way you can do this:

JexlContext jc = JexlHelper.createContext();
jc.getVars().put("System", System.class);
Expression e;
e = ExpressionFactory.createExpression("System.currentTimeMillis()");
Object o = e.evaluate(jc);

---------------------------------------------------------------------
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