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.defaults;
10:
11: import org.nanocontainer.aop.AspectsApplicator;
12: import org.picocontainer.ComponentAdapter;
13: import org.picocontainer.PicoContainer;
14: import org.picocontainer.PicoInitializationException;
15: import org.picocontainer.PicoIntrospectionException;
16: import org.picocontainer.defaults.AssignabilityRegistrationException;
17: import org.picocontainer.defaults.DecoratingComponentAdapter;
18: import org.picocontainer.defaults.NotConcreteRegistrationException;
19:
20: /**
21: * @author Stephen Molitor
22: */
23: public class AspectsComponentAdapter extends DecoratingComponentAdapter {
24:
25: private final AspectsApplicator aspectsApplicator;
26:
27: public AspectsComponentAdapter(AspectsApplicator aspectsApplicator,
28: ComponentAdapter delegate) {
29: super (delegate);
30: this .aspectsApplicator = aspectsApplicator;
31: }
32:
33: public Object getComponentInstance(PicoContainer pico)
34: throws PicoInitializationException,
35: PicoIntrospectionException,
36: AssignabilityRegistrationException,
37: NotConcreteRegistrationException {
38: Object component = super.getComponentInstance(pico);
39: return aspectsApplicator.applyAspects(getComponentKey(),
40: component, pico);
41: }
42:
43: }
|