org.picocontainer.defaults
Class ImplementationHidingComponentAdapter
java.lang.Object
org.picocontainer.defaults.DecoratingComponentAdapter
org.picocontainer.defaults.ImplementationHidingComponentAdapter
- All Implemented Interfaces:
- java.io.Serializable, ComponentAdapter, ComponentMonitorStrategy, LifecycleStrategy, LifecycleManager
- Direct Known Subclasses:
- ImplementationHidingComponentAdapter
public class ImplementationHidingComponentAdapter
- extends DecoratingComponentAdapter
This component adapter makes it possible to hide the implementation
of a real subject (behind a proxy) provided the key is an interface.
This class exists here, because a) it has no deps on external jars, b) dynamic proxy is quite easy.
The user is prompted to look at picocontainer-gems for alternate and bigger implementations.
- Since:
- 1.2, moved from package
org.picocontainer.alternatives
- Author:
- Aslak Hellesøy, Paul Hammant
- See Also:
for a more feature-rich version of this class.
,
Serialized Form
Field Summary |
private boolean |
strict
|
Methods inherited from class org.picocontainer.defaults.DecoratingComponentAdapter |
accept, changeMonitor, currentMonitor, dispose, dispose, getComponentImplementation, getComponentKey, getDelegate, hasLifecycle, hasLifecycle, start, start, stop, stop, toString, verify |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
strict
private final boolean strict
ImplementationHidingComponentAdapter
public ImplementationHidingComponentAdapter(ComponentAdapter delegate,
boolean strict)
- Creates an ImplementationHidingComponentAdapter with a delegate
- Parameters:
delegate
- the component adapter to which this adapter delegatesstrict
- the scrict mode boolean
getComponentInstance
public java.lang.Object getComponentInstance(PicoContainer container)
throws PicoInitializationException,
PicoIntrospectionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Description copied from interface:
ComponentAdapter
- Retrieve the component instance. This method will usually create a new instance each time it is called, but that
is not required. For example,
CachingComponentAdapter
will always return the
same instance.
- Specified by:
getComponentInstance
in interface ComponentAdapter
- Overrides:
getComponentInstance
in class DecoratingComponentAdapter
- Parameters:
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.
- Returns:
- the component instance.
- Throws:
PicoInitializationException
- if the component could not be instantiated.
PicoIntrospectionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambigous situation within the
container.
AssignabilityRegistrationException
NotConcreteRegistrationException
createProxy
private java.lang.Object createProxy(java.lang.Class[] interfaces,
PicoContainer container,
java.lang.ClassLoader classLoader)
verifyInterfacesOnly
private java.lang.Class[] verifyInterfacesOnly(java.lang.Class[] classes)