Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Thursday, June 09, 2005

Annotations for Tapestry

I'm starting a last minute effort to put basic annotations support into Tapestry 4.0, as part of the main distribution. So far, it's going in very clean. The annotations will allow you to do things in the Java class that are normally reserved for the page or component specifications.

The support will be provided as its own separate, optional library, but part of the Tapestry distribution. The main code will still be JDK 1.3 compatible. We'll be building under JDK 1.5, but setting the compiler's source and target parameters to 1.3/1.1 when building the main line code (keep your fingers crossed!); only the annotation code gets the full JDK 1.5 support.

Because of HiveMind, it will just be a matter of dropping the annotations JAR into the classpath and annotation support will be wired in. That's what HiveMind's all about.

The first annotation I'm working on is @InjectObject, i.e.

public abstract WebRequest getRequest();

This is equivalent to:

<inject property="request" object="infrastructure:request"/>
in the XML.

One thing I'm missing would be the ability to specify, in Eclipse, on a source-folder by source-folder basis, what compiler and compiler options to use. In addition, I jettisoned commons-lang as a dependency ... its enum support conflicts with the JDK 1.5 enum keyword; that means EnumPropertySelectionModel had to go as well.


Matt Raible said...

Why not use the existing Tapestry Annotations?

Howard said...

I want to learn about annotations

I'll be responsible for it once it goes into CVS either way

It shouldn't require an application extension, it should just work

There's a demand for this to be part of the base distro

Pekka Enberg said...

Howard, would you be so kind to explain what technical advantages your approach has? I am not sure I understood them. Thanks.

Radur said...

Why not use retroweaver for 1.4 compatibility?
This looks nice, I hate all the xml/abstract class/methods for defining properties and
with what Tapestry Annotations provide I’m pretty happy and I think it should go in the main distribution.

Mauro said...

What about annogen(http://annogen.codehaus.org/Overview)
maybe it culd be a good choice