I'm trying to understand how to combine them (if possible) in this Java 1.7 code:
class View{
private State _state;
}
abstract class State{
protected View _view;
}
class UserState extends State{}
class AdminState extends State {}
I've tried to understand them better using these articles: dependency-injection and state-design-pattern. But I ended only more confused.
My questions are:
Can I somehow inject States in the View class and avoid keeping State instance ?
What I am missing in my code to achieve it?
Thanks in advance.