How can I realize with Java Reflection this case:
RequestDocument req = RequestDocument.Factory.newInstance();
Factory is a static nested class of
newInstance is a public static method, the equivalent of your code using reflection is then:
Object req = Class.forName("my.package.RequestDocument$Factory") .getMethod("newInstance") .invoke(null);
Please note the
$ used to indicate that it is an inner class and
null used as object on which we want to invoke the method because it is a static call so no instance is needed.