|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
BeanPropertyComponentAdapterFactory.java | - | 83.3% | 66.7% | 77.8% |
|
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 |
* Original code by *
|
|
9 |
*****************************************************************************/
|
|
10 |
package org.picocontainer.defaults;
|
|
11 |
|
|
12 |
import org.picocontainer.ComponentAdapter;
|
|
13 |
import org.picocontainer.Parameter;
|
|
14 |
import org.picocontainer.PicoIntrospectionException;
|
|
15 |
|
|
16 |
import java.util.HashMap;
|
|
17 |
import java.util.Map;
|
|
18 |
|
|
19 |
/**
|
|
20 |
* A {@link ComponentAdapterFactory} that creates
|
|
21 |
* {@link BeanPropertyComponentAdapter} instances.
|
|
22 |
*
|
|
23 |
* @author Aslak Hellesøy
|
|
24 |
* @version $Revision: 1.8 $
|
|
25 |
* @since 1.0
|
|
26 |
*/
|
|
27 |
public class BeanPropertyComponentAdapterFactory extends DecoratingComponentAdapterFactory { |
|
28 |
private Map adapterCache = new HashMap(); |
|
29 |
|
|
30 |
/**
|
|
31 |
* Construct a BeanPropertyComponentAdapterFactory.
|
|
32 |
*
|
|
33 |
* @param delegate the wrapped factory.
|
|
34 |
*/
|
|
35 | 18 |
public BeanPropertyComponentAdapterFactory(ComponentAdapterFactory delegate) {
|
36 | 18 |
super(delegate);
|
37 |
} |
|
38 |
|
|
39 |
/**
|
|
40 |
* {@inheritDoc}
|
|
41 |
*/
|
|
42 | 18 |
public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { |
43 | 18 |
ComponentAdapter decoratedAdapter = super.createComponentAdapter(componentKey, componentImplementation, parameters);
|
44 | 18 |
BeanPropertyComponentAdapter propertyAdapter = new BeanPropertyComponentAdapter(decoratedAdapter);
|
45 | 18 |
adapterCache.put(componentKey, propertyAdapter); |
46 | 18 |
return propertyAdapter;
|
47 |
} |
|
48 |
|
|
49 |
// TODO: What is this method for? It is not used in complete Pico/Nano and caching is normally done by CachingCA ...
|
|
50 |
/**
|
|
51 |
* @deprecated
|
|
52 |
*/
|
|
53 | 0 |
public BeanPropertyComponentAdapter getComponentAdapter(Object key) {
|
54 | 0 |
return (BeanPropertyComponentAdapter) adapterCache.get(key);
|
55 |
} |
|
56 |
} |
|
57 |
|
|