The Mixins will be evaluated from left-to-right as they are declared within the @Mixins annotation, and the each super interface will be scanned likewise. It is also possible to declare Mixins on Mixin implementation classes, typically to declare private Mixins needed by a Mixin. The @Mixins declared on Mixin implementations will be evaluated after the @Mixin declarations in the interfaces.
Precedence means that the first Mixin implementation found to satisfy a MixinType method will be used. Interfaces are searched before classes and Mixins implementing the MixinType will be selected before GenericMixins.
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation is used in composites to
* declare mixin implementation classes.
* <p/>
* Mixins tells the runtime which implementation
* class of a Mixin should be used.
* The @Mixins annotation can occur at any
* level in the composite hierarchy
* and the runtime will match each found
* Mixin implementation against a Mixins annotation.
* All mixin interfaces must have a Mixin
* implementation in the composite hierarchy or
* a runtime exception will occur.
* <p/>
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.TYPE )
@Documented
public @interface Mixins
{
Class<?>[] value();
}
public interface MyStuff
{
void doStuff();
}
public interface OtherStuff
{
Property<String> stuff();
}
public class MyStuffMixin
implements MyStuff
{
public void doStuff()
{
// impl code goes here.
}
}