Generic factory of generic containers
- by Feuermurmel
I have a generic abstract class Factory<T> with a method createBoxedInstance() which returns instances of T created by implementations of createInstance() wrapped in the generic container Box<T>.
abstract class Factory<T> {
abstract T createInstance();
public final Box<T> createBoxedInstance() {
return new…