|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer
| Constructor Summary | |
AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate)
|
|
| Method Summary | |
void |
accept(PicoVisitor visitor)
Accepts a visitor that should visit the child containers, component adapters and component instances. |
boolean |
addChildContainer(PicoContainer child)
Add a child container. |
void |
dispose()
Dispose this component. |
boolean |
equals(Object obj)
|
ComponentAdapter |
getComponentAdapter(Object componentKey)
Find a component adapter associated with the specified key. |
ComponentAdapter |
getComponentAdapterOfType(Class componentType)
Find a component adapter associated with the specified type. |
Collection |
getComponentAdapters()
Retrieve all the component adapters inside this container. |
List |
getComponentAdaptersOfType(Class componentType)
Retrieve all component adapters inside this container that are associated with the specified type. |
Object |
getComponentInstance(Object componentKey)
Retrieve a component instance registered with a specific key. |
Object |
getComponentInstanceOfType(Class componentType)
Find a component instance matching the specified type. |
List |
getComponentInstances()
Retrieve all the registered component instances in the container, (not including those in the parent container). |
List |
getComponentInstancesOfType(Class type)
Returns a List of components of a certain componentType. |
protected MutablePicoContainer |
getDelegate()
|
PicoContainer |
getParent()
Retrieve the parent container of this container. |
ComponentAdapter |
registerComponent(ComponentAdapter componentAdapter)
Register a component via a ComponentAdapter. |
ComponentAdapter |
registerComponentImplementation(Class componentImplementation)
Register a component using the componentImplementation as key. |
ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation)
Register a component. |
ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation,
Parameter[] parameters)
Register a component and creates specific instructions on which constructor to use, along with which components and/or constants to provide as constructor arguments. |
ComponentAdapter |
registerComponentInstance(Object componentInstance)
Register an arbitrary object. |
ComponentAdapter |
registerComponentInstance(Object componentKey,
Object componentInstance)
Register an arbitrary object as a component in the container. |
boolean |
removeChildContainer(PicoContainer child)
Remove a child container from this container. |
void |
start()
Start this component. |
void |
stop()
Stop this component. |
ComponentAdapter |
unregisterComponent(Object componentKey)
Unregister a component by key. |
ComponentAdapter |
unregisterComponentByInstance(Object componentInstance)
Unregister a component by instance. |
void |
verify()
Verify that the dependencies for all the registered components can be satisfied. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.picocontainer.MutablePicoContainer |
makeChildContainer |
| Constructor Detail |
public AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate)
| Method Detail |
protected MutablePicoContainer getDelegate()
public ComponentAdapter registerComponentImplementation(Object componentKey,
Class componentImplementation)
throws PicoRegistrationException
MutablePicoContainer
registerComponentImplementation in interface MutablePicoContainercomponentKey - a key that identifies the component. Must be unique within the container. The type
of the key object has no semantic significance unless explicitly specified in the
documentation of the implementing container.componentImplementation - the component's implementation class. This must be a concrete class (ie, a
class that can be instantiated).
getXXX() methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
PicoRegistrationException - if registration of the component fails.a variant of this method that allows more control
over the parameters passed into the componentImplementation constructor when constructing an instance.
public ComponentAdapter registerComponentImplementation(Object componentKey,
Class componentImplementation,
Parameter[] parameters)
throws PicoRegistrationException
MutablePicoContainernew Parameter[]{new ComponentParameter(), new ComponentParameter("someService"}
The default constructor for the component parameter indicates auto-wiring should take place for
that parameter.
new Parameter[] {}
registerComponentImplementation in interface MutablePicoContainercomponentKey - a key that identifies the component. Must be unique within the container. The type
of the key object has no semantic significance unless explicitly specified in the
documentation of the implementing container.componentImplementation - the component's implementation class. This must be a concrete class (ie, a
class that can be instantiated).parameters - an array of parameters that gives the container hints about what arguments to pass
to the constructor when it is instantiated. Container implementations may ignore
one or more of these hints.
getXXX() methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
PicoRegistrationException - if registration of the component fails.Parameter,
ConstantParameter,
ComponentParameter
public ComponentAdapter registerComponentImplementation(Class componentImplementation)
throws PicoRegistrationException
MutablePicoContainerregisterComponentImplementation(componentImplementation, componentImplementation).
registerComponentImplementation in interface MutablePicoContainercomponentImplementation - the concrete component class.
getXXX() methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
PicoRegistrationException - if registration fails.
public ComponentAdapter registerComponentInstance(Object componentInstance)
throws PicoRegistrationException
MutablePicoContainerregisterComponentImplementation(componentImplementation, componentImplementation).
registerComponentInstance in interface MutablePicoContainercomponentInstance -
getXXX() methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
PicoRegistrationException - if registration fails.
public ComponentAdapter registerComponentInstance(Object componentKey,
Object componentInstance)
throws PicoRegistrationException
MutablePicoContainer
registerComponentInstance in interface MutablePicoContainercomponentKey - a key that identifies the component. Must be unique within the conainer. The type of the
key object has no semantic significance unless explicitly specified in the implementing
container.componentInstance - an arbitrary object.
getXXX() methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
PicoRegistrationException - if registration fails.
public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
throws PicoRegistrationException
MutablePicoContainer
registerComponent in interface MutablePicoContainercomponentAdapter - the adapter
PicoRegistrationException - if registration fails.public ComponentAdapter unregisterComponent(Object componentKey)
MutablePicoContainer
unregisterComponent in interface MutablePicoContainercomponentKey - key of the component to unregister.
public ComponentAdapter unregisterComponentByInstance(Object componentInstance)
MutablePicoContainer
unregisterComponentByInstance in interface MutablePicoContainercomponentInstance - the component instance to unregister.
public Object getComponentInstance(Object componentKey)
PicoContainer
getComponentInstance in interface PicoContainercomponentKey - the key that the component was registered with.
null if no component has been registered for the specified
key.public Object getComponentInstanceOfType(Class componentType)
PicoContainer
getComponentInstanceOfType in interface PicoContainercomponentType - the type of the component
null if no component has been registered
with a matching typepublic List getComponentInstances()
PicoContainer
getComponentInstances in interface PicoContainerpublic PicoContainer getParent()
PicoContainer
getParent in interface PicoContainerPicoContainer instance, or null if this container does not have a parent.public ComponentAdapter getComponentAdapter(Object componentKey)
PicoContainer
getComponentAdapter in interface PicoContainercomponentKey - the key that the component was registered with.
null if no component has been
registered for the specified key.public ComponentAdapter getComponentAdapterOfType(Class componentType)
PicoContainer
getComponentAdapterOfType in interface PicoContainercomponentType - the type of the component.
null if no component has been
registered for the specified key.public Collection getComponentAdapters()
PicoContainer
getComponentAdapters in interface PicoContainerComponentAdapters inside this container. The collection will not
be modifiable.a variant of this method which returns the component adapters inside this
container that are associated with the specified type.public List getComponentAdaptersOfType(Class componentType)
PicoContainer
getComponentAdaptersOfType in interface PicoContainercomponentType - the type of the components.
ComponentAdapters inside this container that are associated with
the specified type. Changes to this collection will not be reflected in the container itself.
public void verify()
throws PicoVerificationException
PicoContainer
verify in interface PicoContainerPicoVerificationException - if there are unsatisifiable dependencies.public void start()
Startable
start in interface Startablepublic void stop()
StartableDisposable if you need a single call at the definite end of the lifecycle.
stop in interface Startablepublic void dispose()
Disposable
dispose in interface Disposablepublic boolean addChildContainer(PicoContainer child)
MutablePicoContainer
addChildContainer in interface MutablePicoContainerchild - the child container
true if the child container was not already in.public boolean removeChildContainer(PicoContainer child)
MutablePicoContainer
removeChildContainer in interface MutablePicoContainerchild - the child container
true if the child container has been removed.public void accept(PicoVisitor visitor)
PicoContainer
accept in interface PicoContainervisitor - the visitor
public List getComponentInstancesOfType(Class type)
throws PicoException
PicoContainer
getComponentInstancesOfType in interface PicoContainertype - the searched type.
PicoException - if the instantiation of a component failspublic boolean equals(Object obj)
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||