I'm working in some GWT application in which I have a hierarchy where I have an abstract presenter with some common functionality of derived classes. Something like:
public abstract class MyAbstractPresenter<T extends MyAbstractPresenter.CustomDisplay> extends Presenter<T>
{
public interface CustomDisplay extends View
{
//some methods
}
//I want to inject this element
@Inject
private CustomObject myObj;
public MyAbstractPresenter(T display)
{
super(display);
}
}
All the subclasses get injected properly. However, I want to be able to inject that particular field without having it to add it in the constructor of the subclasses. I tried to do field injection as you see , but it doesn't work as it is the subclasses the one that get injected.
Is there a proper way to achieve this Injection without letting the subclasses know about the existence of the field?