Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ issue or ...

Hi all,

I got an issue with AspectJ. Actually I have got 2 classes (Cache and Aclass) and 1 aspect (WriteBack). I'd like to advise methods in Aclass by declaring pointcuts in WriteBack, but I need to write the result of those functions in Cache. My issue is how can I recuperate my Cache in which I want to write to.

here is an example :

public privileged aspect WriteBack extends WritePolicy {
pointcut writingMethodCalled(Object o): (execution(@WritingMethod void *(*))) && // my methods in Aclass (or somewhere else)
       args(o);

   void around(Object o): writingMethodCalled(o) {
       // We need to find out the current cache
       ICache currentCache = ; // HERE IS THE ISSUE

       (...)
   }

public interface ICache<D> extends Iterable<IEntry<D>>{
   int getSize();
   int getMaxSize();
   // entries with the same tag are merely modified (Data)
   void putEntry(IEntry<D> e);
   IEntry<D> getEntry(Taggable tag);
   IEntry<D> getEntry(Object data);
   void removeEntry(IEntry<D> e);
}

I wondering if I use my aspect with the clause perthis(cacheCreation()), may I recuperate the Cache instance linked with this aspect ?

Thanks in advance,
Jonathan Clairembault


Back to the top