[jboss-user] [JBoss AOP] - The reuse&&JBoss AOP

loupi loupi do-not-reply at jboss.com
Tue Jan 25 17:30:54 EST 2011


loupi loupi [http://community.jboss.org/people/hsma] created the discussion

"The reuse&&JBoss AOP"

To view the discussion, visit: http://community.jboss.org/message/583176#583176

--------------------------------------------------------------
*Hello,*
*First, i really need someone to answer me, because I have many questions, but in this forum only a few people answer*

*Question N=°1 how JBoss AOP defines an abstract aspect? and how it makes the reuse?(example in AspectJ we find  Abstarct aspect)*

*Question N=°2 how can we access to variable with the mixin mechanism?because I followed your example* 

|| *MixIN example* ||
| package Fooo;
public class Foo {
      public int fooField;
      public Foo () {
        fooField = 0;
      }

      public String fooMethod (int i) {
        return Integer.toString (fooField + i);
      }
    } |
| package Fooo;
public interface FooMixinInt {
      public String fooMethod2 (int i);
    } |
| package Fooo;
public class FooMixin implements FooMixinInt {

      public String fooMethod2 (int i) {
       return Integer.toString (fooField - i);

      }
    } |
| package Fooo;
public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Foo foo = new Foo ();
        FooMixinInt fooint = (FooMixinInt) foo;
        String s = fooint.fooMethod2 (-2);

    }

} |


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<aop>
    <introduction class="Fooo.Foo">
        <mixin>
            <interfaces>Fooo.FooMixinInt</interfaces>
            <class>Fooo.FooMixin</class>
            <construction>new Fooo.FooMixin()</construction>
        </mixin>
    </introduction>  
</aop>


*and I often find this error:*

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    fooField cannot be resolved

    at Fooo.FooMixin.fooMethod2(FooMixin.java:6)
    at Fooo.Foo.Fooo$Foo$fooMethod2$aop(Foo.java)
    at Fooo.Foo$FooAdvisor.fooMethod24106554489332185313(Foo$FooAdvisor.java)
    at Fooo.Foo.fooMethod2(Foo.java)
    at Fooo.Main.main(Main.java:12)


*Thank you  :)*
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/583176#583176]

Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110125/d276b9cd/attachment.html 


More information about the jboss-user mailing list