Create a string with the result of the expression and the expression that triggered the value. Is it possible?
3 answers
ScriptEngine engine = new ScriptEngineManager().getEngineByName("beanshell");
Object result = engine.eval("new Object().toString();");
System.out.println(result);
You can get close to what you want using BeanShell. I have executed the above code from Java 6 with BeanShell 2.0b4 and JSR 223 based bsh-engine.jar engine on the classpath.
+2
a source to share
There is a great post here: Creating Static Proxy Classes - http://www.javaspecialists.eu/archive/Issue180.html
Part one is enough for what you asked, I guess
+1
a source to share