Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor rewording

...

This is a method that is placed in a module class. Note the terminology: advise is the verb ("to advise a method") and advice is the noun ("with this advice"). The MethodAdviceReceiver is a wrapper around the service being advised: you can add advice to some or all methods of the service, and also obtain the interface of the service. It is automatically passed into service advisor methods.

The See Injection in Detail describes for what can be injected into a service advisor method.

...

Service advisor methods are always void methods (this is different from service decorator methods).

The @Match("*") annotation indicates that this advice applies to all services (both your own, and those defined by Tapestry). You will want to narrow down which services are actually targeted in most cases.

Note that some services, especially those built -in to into Tapestry IoC, are marked as not subject to decoration, this applies to service advice as well as service decoration.

...

Advice is pretty efficient, but it would is still be better to apply it only to methods that make sense. We can improve our the service advisor method in our example to only advise methods that return String:

...