a1programmer
asked on
Dynamic evaluation
Java experts,
Is it possible to do dynamic evaluation in Java?
public class test
{
public static String username;
public static void set(String name, String value)
{
eval(name + '=' + value);
}
}
If I called:
test.set("username","some_ name");
the value "some_name" would get placed in the username String.
Is it possible to do dynamic evaluation in Java?
public class test
{
public static String username;
public static void set(String name, String value)
{
eval(name + '=' + value);
}
}
If I called:
test.set("username","some_
the value "some_name" would get placed in the username String.
You could use a Java app-enabled scripting language (try Groovy) or beanshell
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's exactly what I was looking for.
Thanks!
Thanks!
ASKER
CEHJ,
Thank you as well for recommending those scripting language. I had never heard of either, but will keep them at hand for the future.
Thank you as well for recommending those scripting language. I had never heard of either, but will keep them at hand for the future.