Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Newbie - need very basic examples - AspectJ annotation style

It's true that the online documentation is not terribly organized, and that
examples of many common cases are missing.    But the information
*is* there -- you just have to dig for it.    A lot of what you're looking
for will be in the developers notebook (which has most of the annotation style
documentation):
http://www.eclipse.org/aspectj/doc/released/adk15notebook/index.html

Ross


CheapLisa wrote:

My IDE only supports annotation style with AspectJ and I am in need of
examples for annotation style.  I bought a book (no examples with annotation
style) and have read a lot of documentation but can not get this one simple
thing to work.

1) Example of an aspect that runs after any Throwable and logs the exception
(cause, message) + stack trace (any throwable anywhere Runtime exception or
checked exception.

2) Example same as the above (run after any Throwable) but limited to any
Throwable in a specific package like "com.mycompany.*"

I found examples that are non-annotation style, tried to translate them to
annotation style but they did not work.  This is such a common thing I
believe someone will have an example they can attach, email or paste into
this response.

I recently inherited a big blob of code and believe there are all sorts of
things going on under the hood that I can't see.  This would help me log any
exception anywhere and see what may be going awry.

I believe if I had examples of the @Pointcut and @After I could fill in the
body of the method to do what I need.  I'm just not sure how to catch every
throwable and then write another one that will catch every throwable given a
package name.

thanks!!!


Lisa


Back to the top