You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Régis Piccand <gm...@piccand.com> on 2003/11/22 14:58:01 UTC

Write a getter for synthetised properties declared in .page ?

I have a transient property (say tableModel) in the .page file. I declared the 
corresponding class abstract and have an abstract setTableModel(ITableModel 
aTableModel). However, I don't want an abstract getTableModel() as it needs to 
do some computation (read DB, etc.).

In run-time, I get the following exception :

Unable to enhance class Admin_customers because it implements a non-abstract 
read method for property 'tableModel'.

Is there a way to declare a transient property in .page and still write a 
specialized getter/setter ?

Thanks in advance for any help

Regis



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


Re: Write a getter for synthetised properties declared in .page ?

Posted by Régis Piccand <gm...@piccand.com>.
Thanks a lot Howard and Erik ... that does the trick :-)

Regis

Erik Hatcher wrote:

> Why not have abstract setter, omit the getter altogether, and in your 
> submit event listener (or beginPageRender event) create the table model 
> and call the setter?   That should do what you're after, right?
> 
>     Erik
> 
> 
> On Saturday, November 22, 2003, at 05:58  AM, Régis Piccand wrote:
> 
>> I have a transient property (say tableModel) in the .page file. I 
>> declared the corresponding class abstract and have an abstract 
>> setTableModel(ITableModel aTableModel). However, I don't want an 
>> abstract getTableModel() as it needs to do some computation (read DB, 
>> etc.).
>>
>> In run-time, I get the following exception :
>>
>> Unable to enhance class Admin_customers because it implements a 
>> non-abstract read method for property 'tableModel'.
>>
>> Is there a way to declare a transient property in .page and still 
>> write a specialized getter/setter ?
>>
>> Thanks in advance for any help
>>
>> Regis
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



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


Re: Write a getter for synthetised properties declared in .page ?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Why not have abstract setter, omit the getter altogether, and in your 
submit event listener (or beginPageRender event) create the table model 
and call the setter?   That should do what you're after, right?

	Erik


On Saturday, November 22, 2003, at 05:58  AM, Régis Piccand wrote:

> I have a transient property (say tableModel) in the .page file. I 
> declared the corresponding class abstract and have an abstract 
> setTableModel(ITableModel aTableModel). However, I don't want an 
> abstract getTableModel() as it needs to do some computation (read DB, 
> etc.).
>
> In run-time, I get the following exception :
>
> Unable to enhance class Admin_customers because it implements a 
> non-abstract read method for property 'tableModel'.
>
> Is there a way to declare a transient property in .page and still 
> write a specialized getter/setter ?
>
> Thanks in advance for any help
>
> Regis
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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


RE: Write a getter for synthetised properties declared in .page ?

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Specifiied properties are for "simple" properties. 

How about:

public MyType getComputedValue()
{
  MyType result = getTransientProperty();

  if (result == null)
  {
    result = computeValue();
    setTransientProperty(result);
  }

  return result;
}

In this way, the transient property is used as a cache for the computed value that will
automatically be cleared at the end of the request cycle.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Régis Piccand
> Sent: Saturday, November 22, 2003 8:58 AM
> To: tapestry-user@jakarta.apache.org
> Subject: Write a getter for synthetised properties declared in .page ?
> 
> 
> I have a transient property (say tableModel) in the .page 
> file. I declared the 
> corresponding class abstract and have an abstract 
> setTableModel(ITableModel 
> aTableModel). However, I don't want an abstract 
> getTableModel() as it needs to 
> do some computation (read DB, etc.).
> 
> In run-time, I get the following exception :
> 
> Unable to enhance class Admin_customers because it implements 
> a non-abstract 
> read method for property 'tableModel'.
> 
> Is there a way to declare a transient property in .page and 
> still write a 
> specialized getter/setter ?
> 
> Thanks in advance for any help
> 
> Regis
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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