Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Using an introduced method from one apsect in another aspect

Hi,

That should work fine.  You either have to compile everything together
(using ajc) or two stage compile, first the aspects that introduce the
method you want to access from the other aspect (e.g. foo) then the
aspects that use it.

Let me know if you have trouble with it.

cheers,
Andy

On 22 December 2011 04:18, Jean-Pierre Bergamin <jpbergamin@xxxxxxxxx> wrote:
> Hello everyone
>
> Is it possible to use a method that gets introduced by static crosscutting
> in one aspect in another aspect?
>
> Lets imagine an aspect Foo that introduces a method "void foo()". Can I now
> use this method foo() in another aspect that introduces other methds with
> static crosscutting?
>
> public interface Foo {
> }
>
> public aspect FooAspect {
>     public void Foo.foo() {
>       // do something
>     }
> }
>
> public aspect BarAspect {
>     public void Bar.bar() {
>         foo(); // How is it possible to call foo() here?
>     }
> }
>
> public class MyEntity implements Foo {
> }
>
> MyEntity e = new MyEntity();
> e.bar();
>
>
> The background:
> We are using Spring Data Neo4j (a.k.a SDN). This framework provides an
> aspect which introduces some methods and fields in entities that are
> annotated with @NodeEntity. We now would like to create our own aspects for
> our entities that in turn use the methods that are introduced by the SDN
> aspsect.
> We'd like to have somthing like:
>
> @NodeEntity
> @ModelAEntity
> public class FooEntity {
> }
>
> @NodeEntity
> @ModelAEntity
> @ModelBEntity
> public class BarEntity {
> }
>
> @NodeEntity
> @ModelBEntity
> @ModelCEntity
> public class BazEntity {
> }
>
> Where the Model(A|B|C)Entity aspects would introduce new methods that all
> need access to the methods introduced by @NodeEntity. Can this be achieved
> somehow?
>
>
> Best regards,
> James
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top