|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.defaults.DecoratingComponentAdapter
org.picocontainer.gems.adapters.AssimilatingComponentAdapter
ComponentAdapter, that assimilates a component for a specific type.
Allows the instance of another ComponentAdapter
to be converted into interfacte type
, that the
instance is not assignable from. In other words the instance of the delegated adapter does NOT necessarily implement the
type
interface.
For Example:
public interface Foo {
int size();
}
public class Bar {
public int size() {
return 1;
}
}
new AssimilatingComponentAdapter(Foo.class, new InstanceComponentAdapter(new Bar()));
Notice how Bar does not implement the interface Foo. But Bar does have an identical size()
method.
Constructor Summary | |
AssimilatingComponentAdapter(Class type,
org.picocontainer.ComponentAdapter delegate)
Construct an AssimilatingComponentAdapter. |
|
AssimilatingComponentAdapter(Class type,
org.picocontainer.ComponentAdapter delegate,
ProxyFactory proxyFactory)
Construct an AssimilatingComponentAdapter. |
Method Summary | |
Class |
getComponentImplementation()
Return the type of the component. |
Object |
getComponentInstance(org.picocontainer.PicoContainer container)
Create and return a component instance. |
Object |
getComponentKey()
Return the key of the component. |
Methods inherited from class org.picocontainer.defaults.DecoratingComponentAdapter |
accept, changeMonitor, currentMonitor, dispose, dispose, 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 |
Constructor Detail |
public AssimilatingComponentAdapter(Class type, org.picocontainer.ComponentAdapter delegate, ProxyFactory proxyFactory) throws org.picocontainer.PicoIntrospectionException
type
may not implement the type of the component instance.
If the component instance does implement the interface, no proxy is used though.
type
- The class type used as key.delegate
- The delegated ComponentAdapter
.proxyFactory
- The ProxyFactory
to use.
org.picocontainer.PicoIntrospectionException
- Thrown if the type
is not compatible and cannot be proxied.public AssimilatingComponentAdapter(Class type, org.picocontainer.ComponentAdapter delegate)
type
may not implement the type of the component instance.
The implementation will use JDK Proxy
instances. If the component instant does
implement the interface, no proxy is used anyway.
type
- The class type used as key.delegate
- The delegated ComponentAdapter
.Method Detail |
public Object getComponentInstance(org.picocontainer.PicoContainer container) throws org.picocontainer.PicoInitializationException, org.picocontainer.PicoIntrospectionException
org.picocontainer.PicoInitializationException
org.picocontainer.PicoIntrospectionException
DecoratingComponentAdapter.getComponentInstance(org.picocontainer.PicoContainer)
public Class getComponentImplementation()
DecoratingComponentAdapter.getComponentImplementation()
public Object getComponentKey()
DecoratingComponentAdapter.getComponentKey()
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |