org.qi4j.api.mixin
Annotation Type Mixins


@Retention(value=RUNTIME)
@Target(value=TYPE)
@Documented
public @interface Mixins

This annotation is used in composites to declare mixin implementation classes.

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.

Example;


 

@Mixins( MyBeerOrder.class ) public interface BeerOrderComposite extends BeerOrder, Composite { }

public class MyBeerOrder implements BeerOrder { : }

Many implementations can be listed,


 @Mixins( { MyBeerOrder.class, DescriptionImpl.class } )
 public interface BeerOrderComposite extends BeerOrder, Description, Composite
 {
 }
 

If the Mixins is a class that implements InvocationHandler, it will be used for all mixins. To avoid that an invocation handler based implementation not service all mixin, use the AppliesTo annotation.

It is valid to have multiple Mixins for a mixin. The first one found will be used. The search order is in the order they are written in the Mixins annotation left-to-right, and depth-first recursive search of the super-interfaces again left-to-right.

See Also:
AppliesTo

Required Element Summary
 Class<?>[] value
           
 

Element Detail

value

public abstract Class<?>[] value