org.picocontainer.behaviors
Class HiddenImplementation

java.lang.Object
  extended by org.picocontainer.behaviors.AbstractBehavior
      extended by org.picocontainer.behaviors.HiddenImplementation
All Implemented Interfaces:
Serializable, Behavior, ComponentAdapter, ComponentMonitorStrategy, LifecycleStrategy
Direct Known Subclasses:
Intercepted

public class HiddenImplementation
extends AbstractBehavior

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.

Author:
Aslak Hellesøy, Paul Hammant
See Also:
for a more feature-rich version of this class., Serialized Form

Field Summary
 
Fields inherited from class org.picocontainer.behaviors.AbstractBehavior
delegate
 
Constructor Summary
HiddenImplementation(ComponentAdapter delegate)
          Creates an ImplementationHidingComponentAdapter with a delegate
 
Method Summary
 Object getComponentInstance(PicoContainer container)
          Retrieve the component instance.
protected  String getName()
           
protected  Object invokeMethod(Method method, Object[] args, PicoContainer container)
           
 String toString()
           
 
Methods inherited from class org.picocontainer.behaviors.AbstractBehavior
accept, changeMonitor, componentHasLifecycle, currentMonitor, dispose, dispose, findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate, hasLifecycle, start, start, stop, stop, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HiddenImplementation

public HiddenImplementation(ComponentAdapter delegate)
Creates an ImplementationHidingComponentAdapter with a delegate

Parameters:
delegate - the component adapter to which this adapter delegates
Method Detail

getComponentInstance

public Object getComponentInstance(PicoContainer container)
                            throws PicoCompositionException
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, Cached will always return the same instance.

Specified by:
getComponentInstance in interface ComponentAdapter
Overrides:
getComponentInstance in class AbstractBehavior
Parameters:
container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
Returns:
the component instance.
Throws:
PicoCompositionException - if the component could not be instantiated.

invokeMethod

protected Object invokeMethod(Method method,
                              Object[] args,
                              PicoContainer container)
                       throws Throwable
Throws:
Throwable

toString

public String toString()
Overrides:
toString in class AbstractBehavior

getName

protected String getName()


Copyright © 2003-2007 Codehaus. All Rights Reserved.