01: /*****************************************************************************
02: * Copyright (c) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Idea by Rachel Davies, Original code by various *
09: *****************************************************************************/package org.nanocontainer.aop.dynaop;
10:
11: import dynaop.MixinFactory;
12: import dynaop.Proxy;
13:
14: import java.util.Properties;
15:
16: /**
17: * Produces mixin advice from a mixin instance object.
18: *
19: * @author Stephen Molitor
20: * @version $Revision: 3144 $
21: */
22: public class InstanceMixinFactory implements MixinFactory {
23:
24: private final Object instance;
25:
26: /**
27: * Creates a new <code>InstanceMixinFactory</code> with the given mixin
28: * instance.
29: *
30: * @param instance the mixin instance.
31: */
32: public InstanceMixinFactory(Object instance) {
33: this .instance = instance;
34: }
35:
36: /**
37: * Returns the mixin instance passed to the constructor.
38: *
39: * @param proxy not used.
40: * @return the mixin instance object passed to the constructor.
41: */
42: public Object create(Proxy proxy) {
43: return instance;
44: }
45:
46: /**
47: * Used for debugging.
48: *
49: * @return a set of properties useful for debugging.
50: */
51: public Properties getProperties() {
52: Properties properties = new Properties();
53: properties.setProperty("advice", "instance mixin");
54: return properties;
55: }
56:
57: }
|