Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] newbie question about @target

You probably need to use the following pointcut:

execution(@Loggable * *.*(..)) || execution(* (@Loggable *).*(..))

-Ramnivas

On Tue, Nov 4, 2008 at 8:06 AM, Miguel Alcalde <miguel.wasabi@xxxxxxxxx> wrote:
Hi all.

I'm trying to implement a declarative logging system. For that I have
created @Loggable annotation:

@Target({ElementType.TYPE, ElementType.METHOD})
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface Loggable {
   LoggableLevel normalLevel()    default LoggableLevel.INFO;
   LoggableLevel errorLevel()    default LoggableLevel.ERROR;
   boolean verbose() default false;
}

I have not idea how to build pointcut _expression_ to captura  calls to
'loggable' classes or 'loggable' methods.

After done many test using combinations of execution, call, @target,
@annotation, @withincode.
For my point of view this should work fine, but... nothing happens

@Pointcut("execution(* *.*(..)) && (
@target(es.git.sistem.commons.Loggable) ||
@withincode(es.git.sistem.commons.Loggable)) && (!within(LoggingAspect))  ")
   private void loggedMethods(){}

Could you help me?

Note: A using maven-aspect-plugin
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top