Package net.sf.jguiraffe.di
Interface MutableBeanStore
-
- All Superinterfaces:
BeanStore
- All Known Implementing Classes:
DefaultBeanStore
public interface MutableBeanStore extends BeanStore
Definition of an interface for a
BeanStore
that can be manipulated.This interface inherits from the basic
BeanStore
interface and adds a set of methods to it that allow for changes of the store, i.e. adding/ removing bean providers or cleaning the whole store.- Version:
- $Id: MutableBeanStore.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
addAnonymousBeanProvider(int index, BeanProvider provider)
Adds an anonymousBeanProvider
to thisBeanStore
.void
addBeanProvider(String name, BeanProvider provider)
Adds the specifiedBeanProvider
to this bean store under the given name.void
clear()
Removes allBeanProvider
s from this bean store.BeanProvider
removeBeanProvider(String name)
Removes theBeanProvider
with the specified name from this bean store.void
setName(String n)
Sets the name of this bean store.void
setParent(BeanStore p)
Sets the parent for this bean store.-
Methods inherited from interface net.sf.jguiraffe.di.BeanStore
getBeanProvider, getConversionHelper, getName, getParent, providerNames
-
-
-
-
Method Detail
-
addBeanProvider
void addBeanProvider(String name, BeanProvider provider)
Adds the specifiedBeanProvider
to this bean store under the given name.- Parameters:
name
- the name of the bean provider (must not be null)provider
- theBeanProvider
to be registered- Throws:
IllegalArgumentException
- if the name or the provider is null
-
addAnonymousBeanProvider
String addAnonymousBeanProvider(int index, BeanProvider provider)
Adds an anonymousBeanProvider
to thisBeanStore
. It is possible to define beans in the context of a dependency tag (e.g. a<param>
tag); then this bean is only visible in this narrow context and cannot be accessed from elsewhere. This makes sense for beans that are used only once and are not shared between different components; then defining the bean directly at the point where it is used is more readable. Such beans do not have a real name, but an internal name is generated by this method, which is treated specially. For instance, internal names won't be returned by theproviderNames()
methods. The passed in index parameter is used for generating a unique name for the provider. It is in the responsibility of the caller to pass in unique numbers.- Parameters:
index
- the index of theBeanProvider
provider
- theBeanProvider
to be registered (must not be null)- Returns:
- the generated name for this
BeanProvider
- Throws:
IllegalArgumentException
- if theBeanProvider
is null
-
removeBeanProvider
BeanProvider removeBeanProvider(String name)
Removes theBeanProvider
with the specified name from this bean store. If this provider cannot be found, this operation has no effect.- Parameters:
name
- the name of the provider to remove- Returns:
- a reference to the removed provider or null if it could not be found
-
clear
void clear()
Removes allBeanProvider
s from this bean store.
-
setName
void setName(String n)
Sets the name of this bean store.- Parameters:
n
- the new name
-
setParent
void setParent(BeanStore p)
Sets the parent for this bean store.- Parameters:
p
- the parent
-
-