This is what my initialize looks like:

    final private static SafeCode SC = new SafeCode(MyBasePage.class);

    protected void initialize() {
        super.initialize();
        if (SC.isDebugEnabled()) {
            Object[] p = {this};
            SC.debug("Initialize {0}", p);
        }
        this.delegate = null;
        this.message = null;
    }
 
two differences I see.

1. I use a static for my logging tool.
2. I call the super method.

Richard
-----Original Message-----
From: Lukasz Kucharski [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 08, 2005 2:13 PM
To: [email protected]
Subject: Encapsulating common functionality in SuperPage HOW?

HI

I have the  following problem.
I'd like to extract common functionality for all pages into one
MyBasePage which implement this common functionality.

Problem 1:
MyBasePage extends BasePage and add some functionalities there,
including some properties. I cannot declare properties in page
specification and use abstract getters/setters because I need pure
implementation here. So i need to ensure each property is reset after
page gets back to the pool. Here is the strange part

public class GenericPage extends BasePage {
        
        protected Logger log = Logger.getLogger(GenericPage.class);
        
        private String message = "";
        
        public void initialize()
        {
                //log.debug("Calling initialize in : generic" );
                this.message = "DUPAAA";
        }
(...)

}

I don't get it,  you see, every time i uncomment log line in
initialize method i get NullPointerException !!! and don't even know
why. What is worse message String doesn't get initialized here for
"DUPAAA" and when i read it in oter child class it gives me " " blank
value.
Please help!

2: Is this method of mine for common functionality encapsulation any
good or maybe someone knows better solution?

Thanks in advance!
  
-- 
Pozdrawiam

Lukasz Kucharski
[EMAIL PROTECTED]
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to