Is there a way to get a class object in runtime when I pass class name as a string in java using reflection kind of thing. My use case is user passes class name string and the method name to invoke. I have to find if any class with that name exists in that package and if it exists, ask for variables in the constructor to build object, once the user gives those variables build the object and then ask for variables required to invoke the method name he has provided, once the user gives those variables, I will invoke the method and return result to user. How can I achieve this? Can we do it with reflection?
Aucun commentaire:
Enregistrer un commentaire