No, there is no self-contradiction.
This array of class objects you need to give can be dynamic, i.e. created at runtime. Typically it could be read from a configuration file where you will load the Class
object from a String
. This is typically how lot of frameworks (like Spring for the dependency injection) are working when creating proxy instance.
Adapted example from the Proxy
javadoc:
String className = readClassNameFromFile();
Class<?> myClass = Class.forName(className);
Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
new Class[] { myClass },
handler);