You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Zimmek, Jan" <Ja...@jamba.net> on 2005/04/29 16:00:54 UTC

property-specification and initial-value

I have got a question about "<property-specification>" handling.

 

In my ".page"-specification I declared the following:

 

-------------------------

 

            <page-specification class="foo.RegisterFormPage">

                        <property-specification name="customer"
persistent="no" type="foo.CustomerDTO" initial-value="new
foo.CustomerDTO()"/>

                        ...

            </page-specification>

 

-------------------------

 

 

The property accessor/mutator method in "foo.RegisterFormPage" are
declared as abstract and no member-variables are defined.

 

-------------------------

 

abstract class RegisterFormPage extends BasePage

{

            ...

            public abstract CustomerDTO getCustomer();

            public abstract void setCustomer(CustomerDTO customer);

            ...

}

 

-------------------------

 

Currently I am never invoke "setCustomer(null)" anywhere in my source to
explicitly reset the property and it seems to work fine.

On the other hand I have read that "initial-value" is only evaluated
once while page loading and never again.

 

Could this lead to multi-threading issues when not invoking
"setCustomer(null)" manually or is this automatically prevented by
tapestry.

 

thanks

            Jan Zimmek


Re: property-specification and initial-value

Posted by Mind Bridge <mi...@yahoo.com>.
> On the other hand I have read that "initial-value" is only evaluated
> once while page loading and never again.

Do not worry about that. setProperty() is invoked at each request. The value is also usually evaluted at each request (e.g. 'new ArrayList()' will give you a new list each time). 

The only optimization at the moment is that if the value is invariant, it will be evaluated only once in the beginning, as there is no point to evaluate 'null' each time. But the setters are still invoked each time.

Also, every request loads a different page object, so I do not think there should be multithreading issues of that type.

-mb


Zimmek, Jan wrote:

>I have got a question about "<property-specification>" handling.
>
> 
>
>In my ".page"-specification I declared the following:
>
> 
>
>-------------------------
>
> 
>
>            <page-specification class="foo.RegisterFormPage">
>
>                        <property-specification name="customer"
>persistent="no" type="foo.CustomerDTO" initial-value="new
>foo.CustomerDTO()"/>
>
>                        ...
>
>            </page-specification>
>
> 
>
>-------------------------
>
> 
>
> 
>
>The property accessor/mutator method in "foo.RegisterFormPage" are
>declared as abstract and no member-variables are defined.
>
> 
>
>-------------------------
>
> 
>
>abstract class RegisterFormPage extends BasePage
>
>{
>
>            ...
>
>            public abstract CustomerDTO getCustomer();
>
>            public abstract void setCustomer(CustomerDTO customer);
>
>            ...
>
>}
>
> 
>
>-------------------------
>
> 
>
>Currently I am never invoke "setCustomer(null)" anywhere in my source to
>explicitly reset the property and it seems to work fine.
>
>On the other hand I have read that "initial-value" is only evaluated
>once while page loading and never again.
>
> 
>
>Could this lead to multi-threading issues when not invoking
>"setCustomer(null)" manually or is this automatically prevented by
>tapestry.
>
> 
>
>thanks
>
>            Jan Zimmek
>
>
>  
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 4/27/2005
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org