How do i create a new instance of an object from a string?
I want to do this:
Event event = new Event("hello");
event.setName("nice!");
but only having
String object = "Event";
String object_variable_name = "event";
String object_params = "hello";
Is this possible?
You can instantiate a class with the reflection API. But you need the full class name, the simple name (= with no constructor) is not enough.
Assigning it to a variable where the variables name and type are stored in Strings is not possible. The usual pattern to implement this is to use a map: