|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer
public abstract class AbstractDelegatingMutablePicoContainer
Field Summary | |
---|---|
private MutablePicoContainer |
delegate
|
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(java.lang.Object obj)
|
ComponentAdapter |
getComponentAdapter(java.lang.Object componentKey)
Find a component adapter associated with the specified key. |
ComponentAdapter |
getComponentAdapterOfType(java.lang.Class componentType)
Find a component adapter associated with the specified type. |
java.util.Collection |
getComponentAdapters()
Retrieve all the component adapters inside this container. |
java.util.List |
getComponentAdaptersOfType(java.lang.Class componentType)
Retrieve all component adapters inside this container that are associated with the specified type. |
java.lang.Object |
getComponentInstance(java.lang.Object componentKey)
Retrieve a component instance registered with a specific key. |
java.lang.Object |
getComponentInstanceOfType(java.lang.Class componentType)
Find a component instance matching the specified type. |
java.util.List |
getComponentInstances()
Retrieve all the registered component instances in the container, (not including those in the parent container). |
java.util.List |
getComponentInstancesOfType(java.lang.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(java.lang.Class componentImplementation)
Register a component using the componentImplementation as key. |
ComponentAdapter |
registerComponentImplementation(java.lang.Object componentKey,
java.lang.Class componentImplementation)
Register a component. |
ComponentAdapter |
registerComponentImplementation(java.lang.Object componentKey,
java.lang.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(java.lang.Object componentInstance)
Register an arbitrary object. |
ComponentAdapter |
registerComponentInstance(java.lang.Object componentKey,
java.lang.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(java.lang.Object componentKey)
Unregister a component by key. |
ComponentAdapter |
unregisterComponentByInstance(java.lang.Object componentInstance)
Unregister a component by instance. |
void |
verify()
Deprecated. since 1.1 - Use new VerifyingVisitor().traverse(this) |
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 |
Field Detail |
---|
private MutablePicoContainer delegate
Constructor Detail |
---|
public AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate)
Method Detail |
---|
protected MutablePicoContainer getDelegate()
public ComponentAdapter registerComponentImplementation(java.lang.Object componentKey, java.lang.Class componentImplementation) throws PicoRegistrationException
MutablePicoContainer
registerComponentImplementation
in interface MutablePicoContainer
componentKey
- 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(java.lang.Object componentKey, java.lang.Class componentImplementation, Parameter[] parameters) throws PicoRegistrationException
MutablePicoContainer
new 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 MutablePicoContainer
componentKey
- 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(java.lang.Class componentImplementation) throws PicoRegistrationException
MutablePicoContainer
registerComponentImplementation(componentImplementation, componentImplementation)
.
registerComponentImplementation
in interface MutablePicoContainer
componentImplementation
- 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(java.lang.Object componentInstance) throws PicoRegistrationException
MutablePicoContainer
registerComponentImplementation(componentImplementation, componentImplementation)
.
registerComponentInstance
in interface MutablePicoContainer
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(java.lang.Object componentKey, java.lang.Object componentInstance) throws PicoRegistrationException
MutablePicoContainer
registerComponentInstance
in interface MutablePicoContainer
componentKey
- 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 MutablePicoContainer
componentAdapter
- the adapter
PicoRegistrationException
- if registration fails.public ComponentAdapter unregisterComponent(java.lang.Object componentKey)
MutablePicoContainer
unregisterComponent
in interface MutablePicoContainer
componentKey
- key of the component to unregister.
public ComponentAdapter unregisterComponentByInstance(java.lang.Object componentInstance)
MutablePicoContainer
unregisterComponentByInstance
in interface MutablePicoContainer
componentInstance
- the component instance to unregister.
public java.lang.Object getComponentInstance(java.lang.Object componentKey)
PicoContainer
getComponentInstance
in interface PicoContainer
componentKey
- the key that the component was registered with.
null
if no component has been registered for the specified
key.public java.lang.Object getComponentInstanceOfType(java.lang.Class componentType)
PicoContainer
getComponentInstanceOfType
in interface PicoContainer
componentType
- the type of the component
null
if no component has been registered
with a matching typepublic java.util.List getComponentInstances()
PicoContainer
getComponentInstances
in interface PicoContainer
public PicoContainer getParent()
PicoContainer
getParent
in interface PicoContainer
PicoContainer
instance, or null
if this container does not have a parent.public ComponentAdapter getComponentAdapter(java.lang.Object componentKey)
PicoContainer
getComponentAdapter
in interface PicoContainer
componentKey
- the key that the component was registered with.
null
if no component has been
registered for the specified key.public ComponentAdapter getComponentAdapterOfType(java.lang.Class componentType)
PicoContainer
getComponentAdapterOfType
in interface PicoContainer
componentType
- the type of the component.
null
if no component has been
registered for the specified key.public java.util.Collection getComponentAdapters()
PicoContainer
getComponentAdapters
in interface PicoContainer
ComponentAdapter
s 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 java.util.List getComponentAdaptersOfType(java.lang.Class componentType)
PicoContainer
getComponentAdaptersOfType
in interface PicoContainer
componentType
- the type of the components.
ComponentAdapter
s 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 PicoContainer
PicoVerificationException
- if there are unsatisifiable dependencies.public void start()
Startable
start
in interface Startable
public void stop()
Startable
Disposable
if you need a single call at the definite end of the lifecycle.
stop
in interface Startable
public void dispose()
Disposable
dispose
in interface Disposable
public boolean addChildContainer(PicoContainer child)
MutablePicoContainer
addChildContainer
in interface MutablePicoContainer
child
- the child container
true
if the child container was not already in.public boolean removeChildContainer(PicoContainer child)
MutablePicoContainer
removeChildContainer
in interface MutablePicoContainer
child
- the child container
true
if the child container has been removed.public void accept(PicoVisitor visitor)
PicoContainer
accept
in interface PicoContainer
visitor
- the visitorpublic java.util.List getComponentInstancesOfType(java.lang.Class type) throws PicoException
PicoContainer
getComponentInstancesOfType
in interface PicoContainer
type
- the searched type.
PicoException
- if the instantiation of a component failspublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |