KickJava   Java API By Example, From Geeks To Geeks.

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


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.MixinFactory;
13 import dynaop.Proxy;
14
15 import java.util.Properties JavaDoc;
16
17 /**
18  * Produces mixin advice from a mixin instance object.
19  *
20  * @author Stephen Molitor
21  * @version $Revision: 3144 $
22  */

23 public class InstanceMixinFactory implements MixinFactory {
24
25     private final Object JavaDoc instance;
26
27     /**
28      * Creates a new <code>InstanceMixinFactory</code> with the given mixin
29      * instance.
30      *
31      * @param instance the mixin instance.
32      */

33     public InstanceMixinFactory(Object JavaDoc instance) {
34         this.instance = instance;
35     }
36
37     /**
38      * Returns the mixin instance passed to the constructor.
39      *
40      * @param proxy not used.
41      * @return the mixin instance object passed to the constructor.
42      */

43     public Object JavaDoc create(Proxy proxy) {
44         return instance;
45     }
46
47     /**
48      * Used for debugging.
49      *
50      * @return a set of properties useful for debugging.
51      */

52     public Properties JavaDoc getProperties() {
53         Properties JavaDoc properties = new Properties JavaDoc();
54         properties.setProperty("advice", "instance mixin");
55         return properties;
56     }
57
58 }
Popular Tags