Annotations - Declaring Mixins

WARNING - TOPIC NOT WRITTEN - TOPIC ID: 3491

This topic has not yet been written. The content below is from the topic description.
Mixins You declare the mixins in much the same way as you declare introductions. Again, it must be done within a class that has been annotated with @Aspect or @InterceptorDef. import org.jboss.aop.Mixin; @Aspect public class MyAspect { ... @Mixin (target=POJO2.class, interfaces={java.io.Externalizable.class}) public static POJO2ExternalizableMixin createExternalizableMixin(POJO2 pojo) { return new POJO2ExternalizableMixin(pojo); } } You annotate a public static method within the aspect with @Mixin. The target attribute takes the class you want to introduce interfaces into, and the interfaces attribute takes an array of the interfaces you want to add to the class. The method must take a class of the same type as the target as its parameter, and it must contain the logic to create and return an instance of the mixin class.