org.picocontainer.defaults
Class ImplementationHidingComponentAdapter

java.lang.Object
  extended byorg.picocontainer.defaults.DecoratingComponentAdapter
      extended byorg.picocontainer.defaults.ImplementationHidingComponentAdapter
All Implemented Interfaces:
ComponentAdapter, Serializable

Deprecated. Use org.nanocontainer.proxytoys.HotSwappingComponentAdapter instead.

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.

Note that this class doesn't cache instances. If you want caching, use a CachingComponentAdapter around this one.

Version:
$Revision: 1.15 $
Author:
Paul Hammant, Aslak Hellesøy
See Also:
Serialized Form

Constructor Summary
ImplementationHidingComponentAdapter(ComponentAdapter delegate)
          Deprecated. Creates a strict ImplementationHidingComponentAdapter that will throw an exception when trying to instantiate a class that doesn't implement any interfaces.
ImplementationHidingComponentAdapter(ComponentAdapter delegate, boolean strict)
          Deprecated. Alternative constructor allowing to set interface-only strictness.
 
Method Summary
 Object getComponentInstance()
          Deprecated. Retrieve the component instance.
 
Methods inherited from class org.picocontainer.defaults.DecoratingComponentAdapter
getComponentImplementation, getComponentKey, getContainer, getDelegate, setContainer, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImplementationHidingComponentAdapter

public ImplementationHidingComponentAdapter(ComponentAdapter delegate,
                                            boolean strict)
Deprecated. 
Alternative constructor allowing to set interface-only strictness.

Parameters:
delegate - the delegate adapter
strict - 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)
Deprecated. 
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
Method Detail

getComponentInstance

public Object getComponentInstance()
                            throws PicoInitializationException,
                                   PicoIntrospectionException,
                                   AssignabilityRegistrationException,
                                   NotConcreteRegistrationException
Deprecated. 
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
Throws:
PicoInitializationException
PicoIntrospectionException
AssignabilityRegistrationException
NotConcreteRegistrationException


Copyright © 2003-2004 Codehaus. All Rights Reserved.