org.picocontainer.script.bsh
Class BeanShellAdapter

java.lang.Object
  extended by org.picocontainer.adapters.AbstractAdapter
      extended by org.picocontainer.script.bsh.BeanShellAdapter
All Implemented Interfaces:
Serializable, org.picocontainer.ComponentAdapter, org.picocontainer.ComponentMonitorStrategy

public class BeanShellAdapter
extends org.picocontainer.adapters.AbstractAdapter

This adapter relies on Bsh for instantiation (and possibly also initialisation) of component instances.

When ComponentAdapter.getComponentInstance(org.picocontainer.PicoContainer) is called (by PicoContainer), the adapter instance will look for a script with the same name as the component implementation class (but with the .bsh extension). This script must reside in the same folder as the class. (It's ok to have them both in a jar).

The bsh script's only contract is that it will have to instantiate a bsh variable called "instance".

The script will have access to the following variables:

Author:
Leo Simons, Aslak Hellesoy
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter
org.picocontainer.ComponentAdapter.NOTHING
 
Constructor Summary
BeanShellAdapter(Object componentKey, Class<?> componentImplementation, org.picocontainer.Parameter... parameters)
           
BeanShellAdapter(Object componentKey, Class<?> componentImplementation, org.picocontainer.Parameter[] parameters, ClassLoader classLoader)
           
 
Method Summary
 Object getComponentInstance(org.picocontainer.PicoContainer pico, Type into)
           
 String getDescriptor()
           
 void verify(org.picocontainer.PicoContainer pico)
           
 
Methods inherited from class org.picocontainer.adapters.AbstractAdapter
accept, changeMonitor, checkTypeCompatibility, currentMonitor, findAdapterOfType, getComponentImplementation, getComponentInstance, getComponentKey, getDelegate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanShellAdapter

public BeanShellAdapter(Object componentKey,
                        Class<?> componentImplementation,
                        org.picocontainer.Parameter[] parameters,
                        ClassLoader classLoader)

BeanShellAdapter

public BeanShellAdapter(Object componentKey,
                        Class<?> componentImplementation,
                        org.picocontainer.Parameter... parameters)
Method Detail

getComponentInstance

public Object getComponentInstance(org.picocontainer.PicoContainer pico,
                                   Type into)
                            throws org.picocontainer.PicoCompositionException
Throws:
org.picocontainer.PicoCompositionException

verify

public void verify(org.picocontainer.PicoContainer pico)

getDescriptor

public String getDescriptor()


Copyright © 2003-2010 Codehaus. All Rights Reserved.