Using reflection to set an object property
I getting class by name and i need to update them with respective data and my question is how to do it with java I want to add the method some dummy data . I don't know the class type I just getting the class name and use reflection to get his data I use this code to get the class instance and Class<?> classHandle = Class.forName(className); Object myObject = classHandle.newInstance(); // iterate through all the methods declared by the class for (Method method : classHandle.getMethods()) { // find all the set methods if (method.getName().matches("set[A-Z].*") And know that I find the list of