Hi – I am new to aspectj,
I am working through some example and trying to develop a few aspects as a
proof of concept.
The first aspect I am trying to develop is a real simple caching aspect
which caches objects based on the implementation of a tag interface.
What I would like to do is when a constructor is called, check if the
class implements an interface, if it does check the cache. If there is
no reference in the cache, proceed, cache the object and then return it.
Otherwise return the cached instance.
What I need to be able to do is get the name of the class the
constructor is being called on. My pointcut should really select all
constructors in the system (maybe confined to a package) with any
number of arguments. Once I have the class object or the name,
I can determine if the cache should be consulted.
Is this possible? If so could someone provide me with an example of the
pointcut and advice. I would provide what I have already but I
am stumped as to how I can capture class of the object I am trying to
instantiate. My problem is I would like to capture the class as context in
an around advice using a target() like construct.
Thanks in advance.
Jody b.