Hi,

I have created an aspect that can be used to track calls to deprecated methods 
in your product. It is currently implemented in "our product" but I want to 
make a library out of it so we can use it for other products.

The aspect currently looks something like:

aspect DeprecatedMethodLogger {


    pointcut includeDeprecated():execution(public  * *.*(..)) && 
@annotation(Deprecated);
    pointcut excludeBeta():execution(public  * *.*(..)) && 
!@annotation(com.google.common.annotations.Beta);
    pointcut deprecatedMethods():  includeDeprecated() && excludeBeta();
    before() :deprecatedMethods()  {
        if (thisJoinPoint.getTarget() != null) {
            String targetClass = thisJoinPoint.getTarget().getClass().getName();
            List<StackTraceElement> stackTraceElements = 
Arrays.asList(Thread.currentThread().getStackTrace());
            StackTraceHelper stackTraceHelper = new 
StackTraceHelper(stackTraceElements);
            DeprecatedMethodData deprecatedMethodData = 
stackTraceHelper.extractData(targetClass);

 //There is also some additional connections to db and other tools here.

}


In stackTraceHelper there are a number of settings that can be done what is 
relevant in the trace when we try to find the calling class.

These settings I want to to publish so they can be set for each product using 
this library.


So question is if I in all products using it need to create another aspect that 
inherits this one and can set the relevant properties.



so my aspect above would have:


aspect DeprecatedMethodLogger implements DeprecatedMethodLoggerApi {


}


DeprecatedMethodLoggerApi contains setting that can be done.


Then in the products I create:


aspect MyDepreactedMethodLogger extends DeprecatedMethodLogger {


}


Or is there a better way? Suggestions welcome.


br,


//mike





_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to