org.picocontainer.defaults
Class ImplementationHidingComponentAdapter
java.lang.Object
org.picocontainer.defaults.DecoratingComponentAdapter
org.picocontainer.defaults.ImplementationHidingComponentAdapter
- All Implemented Interfaces:
- ComponentAdapter, java.io.Serializable
- public class ImplementationHidingComponentAdapter
- extends DecoratingComponentAdapter
This component adapter makes it possible to hide the implementation
of a real subject (behind a proxy).
If the key of the component is of type Class
and that class represents an interface, the proxy
will only implement the interface represented by that Class. Otherwise (if the key is
something else), the proxy will implement all the interfaces of the underlying subject.
In any case, the proxy will also implement
Swappable
, making it possible to swap out the underlying
subject at runtime.
- Version:
- $Revision: 1.6 $
- Author:
- Aslak Hellesøy, Paul Hammant
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ImplementationHidingComponentAdapter
public ImplementationHidingComponentAdapter(ComponentAdapter delegate,
boolean strict)
- Alternative constructor allowing to set interface-only strictness.
- Parameters:
delegate
- the delegate adapterstrict
- true if the adapter should only accept classes that are hideable behind interfaces.
If false, a non-implementation hidden instance will be created instead of throwing an exception.
ImplementationHidingComponentAdapter
public ImplementationHidingComponentAdapter(ComponentAdapter delegate)
- Creates a strict ImplementationHidingComponentAdapter that will throw an exception
when trying to instantiate a class that doesn't implement any interfaces.
- Parameters:
delegate
- the delegate adapter
getComponentInstance
public java.lang.Object getComponentInstance()
throws PicoInitializationException,
PicoIntrospectionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Description copied from interface:
ComponentAdapter
- Gets the component instance. This method will usually create
a new instance for each call (an exception is
CachingComponentAdapter
).
- Specified by:
getComponentInstance
in interface ComponentAdapter
- Overrides:
getComponentInstance
in class DecoratingComponentAdapter
- Throws:
PicoInitializationException
PicoIntrospectionException
AssignabilityRegistrationException
NotConcreteRegistrationException
Copyright © 2003-2004 Codehaus. All Rights Reserved.