[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] intercept Class but not SubClass
|
Sure...
> ------------Original Message------------
> > If you wanted to exclude ALL subclasses you could use this code:
> >
> > private interface SubclassOfMyClass {}
This defines a marker interface, we will use it to make sure that any subclass of MyClass implements this interfce but MyClass does NOT.
> > declare parents: MyClass+ && !MyClass: SubclassOfMyClass;
This declaration makes a set of types implement SubclassOfMyClass. MyClass+ means MyClass or any of its subtypes. !MyClass means to exclude MyClass. So MyClass+ && !MyClass matches any subclass of MyClass, but NOT MyClass itself.
For more details on declare parents and type patterns, I'd get a good book on AspectJ (like AspectJ in Action), or look at the AspectJ programmer's guide.
>
> could you decrypt the meaning of this 'incantation' please ?
>
> > public pointcut baseConstruction() : execution( MyClass.new() ) && !this(SubclassOfMyClass);
>
> Regards,
>
> -- Eric
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>