I'm trying to make an abstract Object Factory and I tryied a few things and none of them worked.
What I would like to have is something like this that could be overrided:
public abstract ObjectFactory<Obj extends GameObject> {
public abstract <Type extends Enum> Obj createObject (Type t) ;
}
that I could extends ObjectFactory and have:
public AntFactory extends ObjectFactory<Ant> {
@Override
public Ant createObject(AntType t) { }
}
but everything I tryied did not override the createObject method. The only thing that worked for me was:
public abstract ObjectFactory<Obj extends GameObject, Type extends Enum> {
public abstract Obj createObject (Type t) ;
}
Theres something that I'm not understanding about this concept or it doesn't work for enum.
Is there a way to keep the extends of enum only in the method and still override it?