Tacos Annotations

This library does not contain components; instead it provides Tapestry specific annotations (annotations are a a new feature in JDK 1.5 ).

Cached

The Cached annotation allows you to cache the results of a pag/component method for the lifetime of a single request. It can be attached to any non-private, non-abstract method:

  @Cached
  public List getCustomers() {
     // do some expensive operation
     return db.getAllCustomers();
  }

In this way, even if the html template (or other java code) calls that method more than once, it'll only get evaluated the first time and return the same result from then on.

InjectPageLink

The InjectPageLink annotation allows a ILink to be injected into a page or component. It is attached to an accessor method:

  @InjectPageLink("Page")
  public abstract ILink getLink();

InjectExternalLink

The InjectExternalLink annotation allows a ILink to a page implementing the interface IExternalPage to be injected into a page or component. It is attached to an accessor method:

  @InjectExternalLink("ExternalPage")
  public abstract ILink getExternalPage(String... params);

InjectParameterFlag

The InjectParameterFlag will make the boolean accessor method (to which it is attached) return true when the parameter has been bound and false when it has not been. If the method name ends in "Bound", "Bound" is removed to determine the parameter. So, if your component defines a username parameter:

  @Parameter
  public abstract String getUsername();

then you can see if it was bound by:

    @InjectParameterFlag("username")
    public abstract boolean getUsernameParameterExists();

    // or the equivalent
    @InjectParameterFlag()
    public abstract boolean isUsernameBound();