public final class Assimilated<T> extends AbstractBehavior<T>
Allows the instance of another ComponentAdapter to be converted into interface 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 Assimilated(Foo.class, new InstanceAdapter(new Bar()));
Notice how Bar does not implement the interface Foo. But Bar does have an identical size() method.
ComponentAdapter.NOTHINGdelegate| Constructor and Description |
|---|
Assimilated(Class<T> type,
ComponentAdapter delegate)
Construct an Assimilated.
|
Assimilated(Class<T> type,
ComponentAdapter delegate,
ProxyFactory proxyFactory)
Construct an Assimilated.
|
| Modifier and Type | Method and Description |
|---|---|
Class<? extends T> |
getComponentImplementation()
Return the type of the component.
|
T |
getComponentInstance(PicoContainer container,
Type into)
Create and return a component instance.
|
Object |
getComponentKey()
Return the key of the component.
|
String |
getDescriptor() |
accept, changeMonitor, componentHasLifecycle, currentMonitor, dispose, dispose, findAdapterOfType, getComponentInstance, getDelegate, hasLifecycle, isLazy, isStarted, start, start, stop, stop, toString, verifypublic Assimilated(Class<T> type, ComponentAdapter delegate, ProxyFactory proxyFactory) throws PicoCompositionException
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.PicoCompositionException - Thrown if the type is not compatible and cannot be proxied.public Assimilated(Class<T> type, 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.public T getComponentInstance(PicoContainer container, Type into) throws PicoCompositionException
getComponentInstance in interface ComponentAdapter<T>getComponentInstance in class AbstractBehavior<T>PicoCompositionExceptionAbstractBehavior#getComponentInstance(org.picocontainer.PicoContainer, java.lang.Class into)public String getDescriptor()
public Class<? extends T> getComponentImplementation()
getComponentImplementation in interface ComponentAdapter<T>getComponentImplementation in class AbstractBehavior<T>AbstractBehavior.getComponentImplementation()public Object getComponentKey()
getComponentKey in interface ComponentAdapter<T>getComponentKey in class AbstractBehavior<T>AbstractBehavior.getComponentKey()Copyright © 2003-2014 Codehaus. All Rights Reserved.