Interface BeanStore
-
- All Known Subinterfaces:
MutableBeanStore
- All Known Implementing Classes:
CombinedBeanStore
,DefaultBeanStore
,JellyContextBeanStore
,SimpleBeanStoreImpl
public interface BeanStore
Definition of an interface for objects that provide access to bean definitions.
A
BeanStore
maintains an arbitrary number of bean definitions, which are identified by unique names. It is possible to list the names of all available bean definitions, and to access a specific bean definition by its name.BeanStore
s are hierarchical structures: they can have a parent. A typical search algorithm an aBeanStore
will first query the local store, and then - if the specified bean definition could not be found - delegate to its parent store. This allows for complex scenarios where global objects can be defined on the application level, while certain sub contexts have the opportunity of overriding some definitions and define their own local data.This interface is kept quite simple. It should be easy to implement it, e.g. using a map or another context-like object.
- Version:
- $Id: BeanStore.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 BeanProvider
getBeanProvider(String name)
Returns theBeanProvider
that is registered under the given name or null if cannot be found.ConversionHelper
getConversionHelper()
Returns aConversionHelper
object for performing type conversions on the beans contained in thisBeanStore
.String
getName()
Returns a name for this bean store.BeanStore
getParent()
Returns a reference to the parentBeanStore
.Set<String>
providerNames()
Returns a set with the names of allBeanProvider
objects that are registered in this bean store.
-
-
-
Method Detail
-
getBeanProvider
BeanProvider getBeanProvider(String name)
Returns theBeanProvider
that is registered under the given name or null if cannot be found.- Parameters:
name
- the name of theBeanProvider
- Returns:
- the provider registered under this name or null
-
providerNames
Set<String> providerNames()
Returns a set with the names of allBeanProvider
objects that are registered in this bean store.- Returns:
- a set with the names of the contained
BeanProvider
s
-
getName
String getName()
Returns a name for this bean store. The name is mainly used for grouping and accessing bean stores. It does not have a direct impact on bean creation or dependency injection.- Returns:
- a name for this bean store
-
getParent
BeanStore getParent()
Returns a reference to the parentBeanStore
. Bean stores can be organized in a hierarchical manner: if a bean provider cannot be found in a specific bean store, the framework will also search its parent bean store (and recursively the parent's parent, and so on). This makes it possible to create different scopes of beans. The root store should return null.- Returns:
- the parent bean store or null if this is the root store
-
getConversionHelper
ConversionHelper getConversionHelper()
Returns aConversionHelper
object for performing type conversions on the beans contained in thisBeanStore
. To the hierarchy ofBeanStore
objects alsoConversionHelper
objects can be added. This is useful when dealing with specialized beans for which custom converters have to be provided. AConversionHelper
is optional, so an implementation can return null. It is then up to the caller whether it uses a defaultConversionHelper
instance or tries to query the parent bean store.- Returns:
- a
ConversionHelper
instance for performing type conversions related to the beans contained in this store
-
-