I don\'t believe I am implementing the factory pattern correctly because the Application class\' createDocument method accepts any class type, not just
You should bound your generic so that it is only using T's that inherit Document.
example:
public class Application {
//Add extends Document after T
public static T createDocument(Class documentClass) throws InstantiationException, IllegalAccessException {
return documentClass.newInstance();
};
}