Or alternately you may have to use a boolean "fIsInitialized" flag
and your own "initialize" method as lazy initialization doesn't work out so
well for primitives, especially Booleans. Is fLoggedIn false becase we
haven't initialized yet, or false because we aren't logged in :)?
--- Pat
PS There's always static initializer blocks for statics, or you an
initialize right on the declaration in a lots of cases e.g.
private string fName = DEFAULT_VALUE;
> -----Original Message-----
> From: Robert Zeigler [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 19, 2005 9:19 AM
> To: Tapestry users
> Subject: Re: constructors and the initialize method
>
> For those values which should only be init'ed once, why not use
> lazy-instantiation?
>
> public Object getMyObject() {
> if (myObject == null) {
> myObject = new Object();
> }
> return myObject;
> }
>
> Tapestry's contract is that you don't need to worry about the
> synchronization of that method since only a single client has access to
> a single instance of a page at any given time.
> I do this for things like property selection models which won't change
> during the lifetime of the page.
>
> Robert
>
> nat wrote:
> > Hello!
> >
> > It seems to me that when I define an initialize() method within a page
> > class, the constructor of that class will not be executet, not even
> > once. Is it true, or is it just me?
> >
> > (I need the constructor, becouse I have to set up some special values.
> > These values have to be set up only once per page class. And they remain
> > constatnt during the rest of the time of the page class. That is why I
> > do not want to put them into the initialize(). They do not have to be
> > initialize each time the page is loaded.)
> >
> > Attila
> >
> > Ps. I am using Tapestry 3.
> >
> >
>
>
> ---------------------------------------------------------------------
> 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]