commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos DurĂ¡n" <carlostenis...@gmail.com>
Subject jexl method invocation whithout specifying the object (implicit)
Date Tue, 06 May 2008 17:43:29 GMT
Is there any way to do a jexl method invocation whithout specifying the
object?


This is how I have done it until now:

String jexlExp = "foo.bar()";
Expression e = ExpressionFactory.createExpression(jexlExp);
JexlContext jc = JexlHelper.createContext();
jc.getVars().put("foo", new Foo());
Object o = e.evaluate(jc);
System.out.println(o.toString());


But I want something like this:(This code produces errors)

String jexlExp = "bar()";
Expression e = ExpressionFactory.createExpression(jexlExp);
JexlContext jc = JexlHelper.createContext();
Object o = e.evaluate(jc);
System.out.println(o.toString());



I want  the evaluate method  to  know(in some way) that  each method  in
the  jexl expression  always refers to the class Foo (without specifying it
)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message