tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard M. Lewis Ship" <hls...@attbi.com>
Subject Declarative Properties are IN !!!!!!
Date Fri, 24 Jan 2003 01:56:47 GMT
I've been home and on a roll today!

I've put together declarative properties over the last 30 hours.  What are they?  It's a radical
improvement to Tapestry.

You may now declare your transient and persistent properties.  Tapestry will take care of
the rest.  This includes instance variables, accessor methods, initialization, and end-of-request

<property-specification name="foo" type="int" persistent="yes" initial-value="100"/>

What Tapestry does is use BCEL to create a subclass of the page or component class you specify
(or don't specify, in which case a default is used).  It creates the fields and accessor methods
and creates additional objects to re-initialize the property at the end of the request cycle.

If you want, you can declare your class abstract, and provide abstract accessor methods. 
That way you can read and update properties, in a typesafe manner, from your listener methods.

This stuff is just plain magic!  It also helps me because I don't have to discuss the gory
details of initialize() or finishLoad(), at least not right off the bat.  It also means that,
even more often, you can create a very functional page without creating a subclass of BasePage.

And in case you missed it ... this works on components as well as pages.

What's the cost?  Well, we now have bcel-5.0.jar in the classpath.  When a particlar page
or component is first created, Tapestry has to create the enhanced subclass.  That seems to
take about 2ms or so (on my laptop) for each enhanced property.  Again, that cost is paid
once, the first time a particular page or component is instantiated.

It's all in, it's all documented (in the new User's Guide), and the new code has about 98%
code coverage in the JUnit test suite.

Howard Lewis Ship

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message