I've got an aspect that I'd like to weave, at load time, with one or more
arbitrary classes (but ones loaded by the system classloader).

Two problems.  An example of the kind of generic aspect I'd like to use,
Isolator<T>, is below.

I want to weave it around one or more classes I specify at launch time.  I'd
really like to write some kind of launcher class that takes class names as
parameters and does the weaving.  But I could generate an aop.xml file -
that'd work.  Except that it doesn't appear that I can specify an aspect in
aop.xml that extends, say, "Isolator<some class name>".

Alternatively, I could not use generics, and make the below aspect a bit
more general, and have its concrete subaspects specify all the pointcuts
necessary - one for the "within", and one for the internal calls.

Can anybody give me help on these?

Larry Edelstein
Senior Member of Technical Staff
salesforce.com



public abstract aspect Isolator<T> {
pointcut dependencyCall() :
 call()
 && within(T)
 && !internalCall()
 && !platformCall();
 pointcut call() :
 call(* *.*(..))
 || call(*.new(..));
 pointcut internalCall() :
 call(* T.*(..))
 || call(T.new(..));
 pointcut platformCall() :
 call(* java..*.*(..))
 || call(java..*.new(..));
 Object around() : dependencyCall () {
                // Does something here
}
}

public aspect ServiceIsolator extends Isolator<Service> {}
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to