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 156 2009-03-03 21:04:47Z oheger $
Author:
Oliver Heger

Method Summary
 java.lang.String addAnonymousBeanProvider(int index, BeanProvider provider)
          Adds an anonymous BeanProvider to this BeanStore.
 void addBeanProvider(java.lang.String name, BeanProvider provider)
          Adds the specified BeanProvider to this bean store under the given name.
 void clear()
          Removes all BeanProviders from this bean store.
 BeanProvider removeBeanProvider(java.lang.String name)
          Removes the BeanProvider with the specified name from this bean store.
 void setName(java.lang.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, getName, getParent, providerNames
 

Method Detail

addBeanProvider

void addBeanProvider(java.lang.String name,
                     BeanProvider provider)
Adds the specified BeanProvider to this bean store under the given name.

Parameters:
name - the name of the bean provider (must not be null)
provider - the BeanProvider to be registered
Throws:
java.lang.IllegalArgumentException - if the name or the provider is null

addAnonymousBeanProvider

java.lang.String addAnonymousBeanProvider(int index,
                                          BeanProvider provider)
Adds an anonymous BeanProvider to this BeanStore. 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 the providerNames() 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 the BeanProvider
provider - the BeanProvider to be registered (must not be null)
Returns:
the generated name for this BeanProvider
Throws:
java.lang.IllegalArgumentException - if the BeanProvider is null

removeBeanProvider

BeanProvider removeBeanProvider(java.lang.String name)
Removes the BeanProvider 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 all BeanProviders from this bean store.


setName

void setName(java.lang.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


Copyright © 2009 The JGUIraffe Team. All Rights Reserved.