You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/09/22 19:11:00 UTC

DO NOT REPLY [Bug 22193] - Unable to reference statics

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