Flavia Rainone [http://community.jboss.org/people/flavia.rainone%40jboss.com] 
created the discussion

"Re: The reuse&&JBoss AOP"

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

--------------------------------------------------------------
> loupi loupi wrote:
> 
> *Question N=°1 how JBoss AOP defines an abstract aspect? and how it makes the 
> reuse?(example in AspectJ we find  Abstarct aspect)*
JBoss AOP does not define an abstract aspect, you can however write an abstract 
class that will be the superclass of your aspect,  or define a common interface 
to more than one aspects in your system. The reason for this is that JBoss AOP, 
differently from AspectJ, is not an AOP language, it is an AOP tool. It will 
weave code that has been previously compiled with javac.


> loupi loupi wrote:
> 
> *Question N=°2 how can we access to variable with the mixin mechanism?because 
> I followed your example*
See the previous paragraph. As JBoss AOP is a Java tool, your code needs to 
compile first, using a plain Java compiler.
Still, what you want to do can be achieved. There is a very good example in our 
dist, in the examples dir. The  
http://http://docs.jboss.org/jbossaop/docs/2.0.0.GA/docs/aspect-framework/examples/introductions/introductions.html
 introductions example contains the POJO2ExternalizableMixin, that acquires 
access to the class it is applied to, POJO2, in its constructor. You would have 
to do the same, i.e., FooMixin will receive Foo in its constructor, initialize 
a private field with foo, and use that to get access to fooMethod2 value:


public clas FooMixin implements FooInt {
 
     private Foo target;
 
     public FooMixin (Foo foo) {
          target = foo;
     }
 
     public String fooMethod2 (int i) {
          return Integer.toString (target.fooField - i); 
     }
}


Check out introductions example code to see the details (it is in the 
docs/aspect-framework/examples/introductions path of your JBoss AOP 
installation dir).
--------------------------------------------------------------

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

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

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to