package test.mixin; import test.mixin.IGetID; class MixinTest { hook Introduce implements IGetID { private int id=0; Introduce(method(..args)) { execution(method); } public int getTestID() { return id++; } } hook Use { Use(method(..args)) { execution(method); } before() { try { IGetID mixin = (IGetID) mixinOf(thisJoinPointObject,IGetID.class); //does not have to be thisJoinPointObject, any object can have mixins attached System.out.println("before:"+mixin.getTestID()); }catch(jasco.runtime.mixin.NoMixinFound ex){System.err.println("no mixin found");ex.printStackTrace(); } } after() { try { //testing casting regular IGetID mixin = (IGetID) thisJoinPointObject; //does not have to be thisJoinPointObject, any object can have mixins attached System.out.println("after:"+mixin.getTestID()); }catch(jasco.runtime.mixin.NoMixinFound ex){System.err.println("no mixin found");ex.printStackTrace(); } } } }