Object makeOne (Class fooClass) { return fooClass.newInstance(); }
You are missing the point of a factory pattern, which is informed by the non-accidental pattern name: 'Factory'.
[edit: using generics it is even type safe]: <T> T makeOne (Class<T> clazz) { return clazz.newInstance(); }
Object makeOne (Class fooClass) { return fooClass.newInstance(); }
You are missing the point of a factory pattern, which is informed by the non-accidental pattern name: 'Factory'.
[edit: using generics it is even type safe]: <T> T makeOne (Class<T> clazz) { return clazz.newInstance(); }