This content has been marked as final.
Show 3 replies
-
1. Re: POJO component inheritance
kragoth Mar 17, 2010 12:15 AM (in response to jethroborsje.j.borsje.dji.minjus.nl)Can you provide the code please.
-
2. Re: POJO component inheritance
jethroborsje.j.borsje.dji.minjus.nl Mar 17, 2010 8:29 AM (in response to jethroborsje.j.borsje.dji.minjus.nl)I managed to narrow down my problem to the following issue: the subclass (the one with the @Name and @Scope annotations) keeps the values of its variables across the long running conversation, but the variables of the superclass are
forgotten
.This is a snippet of my code:
public abstract class AbstractWizardController { private Stack<String> pages; protedted void init() { pages = new Stack<String(); } public void doStuff() { LOG.debug(pages); } } @Name("myWizardController") @Scope(ScopeType.CONVERSATION) public class WizardControllerImpl extends AbstractController { public String myValue; @Create @Begin public void init() { super.init(); myValue = "test"; } public void doOtherStuff() { // Do other stuff here. LOG.debug(myValue); } }
Each time I move from one page to another the
doStuff()
method gets called. The first time thepages
Stack is an empty stack. When I move to another page thepages
variable is null all of a sudden. -
3. Re: POJO component inheritance
jethroborsje.j.borsje.dji.minjus.nl Jul 19, 2010 5:27 AM (in response to jethroborsje.j.borsje.dji.minjus.nl)I recently found the solution to this problem:
1 - use getters and setters everywhere instead of referencing a class variable directly.
2 - do NOT make the getter and setter methods final.