Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Multiple Method Introductions: patterns?

I am doing method introductions on a large scale while refactoring Apache
Cocoon.  What I have run into is this, I have used AspectJ to extend a large
number of classes to implement an interface
(CacheableProcessingComponenent).  .. so for example:

privileged public aspect CachingAspect {
// This works, clearly.
declare parents: (org.apache.cocoon.transformation.CIncludeTransformer || 
org.apache.cocoon.reading.DatabaseReader || 
org.apache.cocoon.generation.FragmentExtractorGenerator) implements 
CacheableProcessingComponent;

// This requires introducing two methods, one of which is below.   What I
// would like to do is this:

public SourceValidity 
(org.apache.cocoon.transformation.CIncludeTransformer||org.apache.cocoon.reading
.DatabaseReader||org.apache.cocoon.generation.FragmentExtractorGenerator).genera
teValidity() {
  if (this.inputSource == null)
    return null;
  return this.inputSource.getValidity();
}
}

I have a large classes that use this method that I want to insert using this
one introduction. What is the best way to accomplish the above?
I have seen some simple wild-card matching in Ramnivas's book, but I have
not see anything like what I am trying to do.  I have not seen any
complicated examples that would relate to the above.

Suggestions?

Thanks.

- Jeff




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


Back to the top