First AOP use case

My first real AOP use case uses Java 5 annotations and AspectWerkz 2.0. I use AspectWerkz because I can look at their Java source code and I could use Pointcuts to pick out Java 5 annotations. At this point I don’t combine Generics and AOP. I wanted to show a status message only if particular methods were called. This is done so that the status is more accurate. The user will know the exact status at any point in time.

My annotation is

@Target({ ElementType.TYPE,
       ElementType.METHOD })
public @interface StatusShow {

 public String message();

I annotate like this
    @StatusShow( message=”Select diagram” )

I use Java reflection to get the argument to the annotation and print in the
status bar.
public class StatusReportAspect {
 @Expression(“execution(@com.blueprint.util.annotation.StatusShow * *..*(..))”)
    Pointcut statusMethods;

 public void before( final StaticJoinPoint sjp, final JoinPoint jp ) {
   Class<PaperSheet> clazz = PaperSheet.class;
   Method method = clazz.getMethod( sjp.getSignature().getName(),
   if( method.isAnnotationPresent( StatusShow.class )){
      setText( method.getAnnotation( StatusShow.class ).
                   message() );
  }catch( Throwable t ){
   //This is benign. Just ignore.