0

I have a string and a class with a set of functions.

As for example, String is

String tr = "ctx.mkLt(ctx.mkIntConst(\"x\"),ctx.mkInt(100))";

And the class as Context ctx = new Context(); with methods as ctx.mkLt(arg 0, arg 1), ctx.mkIntConst(arg 0, arg 1) and others.

I am not able to convert the string into callable methods of class ctx.

Is there a way to convert the string into the callable method of class as in the above case?

Rituraj Singh
  • 579
  • 1
  • 5
  • 16
  • The reflection api or nashorn... need more context; but if you search with google on either (or both) of those you should find examples. – Elliott Frisch Jun 01 '19 at 20:35
  • 1
    This is almost certainly an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). You want to simulate embedding a Java interpreter in your program, which is almost certainly the most complicated way to do whatever you're trying to do. Why do you think you need this functionality? – Silvio Mayolo Jun 01 '19 at 20:36

0 Answers0