org.apache.tapestry5.plastic
Interface MethodAdvice
- All Known Implementing Classes:
- CommitAfterMethodAdvice, LoggingAdvice
public interface MethodAdvice
MethodAdvice is a special callback that is threaded into the implementation of a method.
The advice recieves a MethodInvocation
, which gives the advice the ability to change
parameters or return values or thrown exceptions. In many cases, new behavior is added around the method invocation
with affecting it; common examples include logging, null checks, transaction management, or security checks.
advise
void advise(MethodInvocation invocation)
- Advise the method, usually invoking
MethodInvocation.proceed()
at some point.
The advice is free to inspect and even replace parameters. Most
Aspects will then invoke MethodInvocation.proceed()
. The advice may then inspect and
replace any checked thrown exceptions. Some advice (for example, caching) may selectively decide to bypass the
invocation entirely, and instead invoke some other method or otherwise set a return value or thrown exception.
- Parameters:
invocation
- identifies the method being invoked, including parameters
Copyright © 2003-2012 The Apache Software Foundation.