I am using SpringBoot,
I have function in String form, I want to execute that function by passing params (so that it behaves like normal java function)
ex:
String s = "public void method_name(String name, int s) {\n" +
" System.out.println(name + s);\n" +
" }";
i want to call this function, input : method_name("abc" , 10)
output: abc10
I there any way or any library in JAVA??
Things i tried:
1) Used java.beans.Statement;
thanks in advance! :)
Why I need this ? I am using this function in JSON file, where i will take this function dynamically. JSON obj :
{
"1":{
"function" : "public void method_name(String name, int s) {\n" +
" System.out.println(name + s);\n" +
" } "
},
"2": {
"function" : another function
}
}
Hope you understand this.