KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > aop > dynaop > MixinComponentAspect


1 /*****************************************************************************
2  * Copyright (c) PicoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  * *
8  * Idea by Rachel Davies, Original code by various *
9  *****************************************************************************/

10 package org.nanocontainer.aop.dynaop;
11
12 import dynaop.Aspects;
13 import dynaop.MixinFactory;
14 import dynaop.Pointcuts;
15 import org.nanocontainer.aop.ComponentPointcut;
16
17 /**
18  * Mixin aspect that is applied to the components that match a component
19  * pointcut.
20  *
21  * @author Stephen Molitor
22  * @version $Revision: 3144 $
23  */

24 class MixinComponentAspect extends ComponentAspect {
25
26     private Class JavaDoc[] mixinInterfaces;
27     private final MixinFactory mixinFactory;
28
29     /**
30      * Creates a new <code>MixinComponentAspect</code> from the given
31      * component pointcut and mixin class. The aspected component will implement
32      * the provided set of mixin interfaces.
33      *
34      * @param componentPointcut the components to introduce the mixin to.
35      * @param mixinInterfaces the mixin interfaces the aspected component will
36      * implement.
37      * @param mixinFactory the mixin factory.
38      */

39     MixinComponentAspect(ComponentPointcut componentPointcut, Class JavaDoc[] mixinInterfaces, MixinFactory mixinFactory) {
40         super(componentPointcut);
41         this.mixinInterfaces = mixinInterfaces;
42         this.mixinFactory = mixinFactory;
43     }
44
45     void doRegisterAspect(Object JavaDoc componentKey, Aspects aspects) {
46         aspects.mixin(Pointcuts.ALL_CLASSES, mixinInterfaces, mixinFactory);
47     }
48
49 }
Popular Tags