|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jguiraffe.di.impl.BeanContextWrapper
public class BeanContextWrapper
A simple wrapper implementation of the BeanContext interface.
The main purpose of this class is to override the default
BeanStore of a bean context. It is initialized with the
BeanContext object to be wrapped and the default
BeanStore to be used. All calls to methods defined by the
BeanContext interface are delegated to the wrapped bean context
object. If they address the default bean store (i.e. no bean store is
explicitly passed to the method), the bean store set for this instance is
used. That way an already configured bean context can be used in a different
context (which means, using another bean store as default entry in the look
up mechanism) without manipulating its state.
| Constructor Summary | |
|---|---|
BeanContextWrapper(BeanContext wrappedContext)
Creates a new instance of BeanContextWrapper and sets the
wrapped context. |
|
BeanContextWrapper(BeanContext wrappedContext,
BeanStore defaultStore)
Creates a new instance of BeanContextWrapper and sets the
wrapped context and the default bean store. |
|
| Method Summary | ||
|---|---|---|
void |
addBeanCreationListener(BeanCreationListener l)
Adds the specified BeanCreationListener to this context. |
|
java.util.Set<java.lang.Class<?>> |
beanClasses()
Returns a set of the classes of the beans available in this bean context's default bean store. |
|
java.util.Set<java.lang.Class<?>> |
beanClasses(BeanStore store)
Returns a set of the classes of the beans available in the specified bean store. |
|
java.lang.String |
beanNameFor(BeanProvider beanProvider)
Returns the name of the given BeanProvider starting the search
with the default bean store. |
|
java.lang.String |
beanNameFor(BeanProvider beanProvider,
BeanStore store)
Returns the name of the given BeanProvider starting the search
with the specified bean store. |
|
java.util.Set<java.lang.String> |
beanNames()
Returns a set with the names of the beans defined in this context's default bean store. |
|
java.util.Set<java.lang.String> |
beanNames(BeanStore store)
Returns a set with the names of the beans defined in the given bean store. |
|
void |
close()
Closes this BeanContext. |
|
boolean |
containsBean(java.lang.Class<?> beanClass)
Checks whether a bean with the given class can be found in this bean context's default bean store. |
|
boolean |
containsBean(java.lang.Class<?> beanClass,
BeanStore store)
Checks whether a bean with the given class can be found in the specified bean store. |
|
boolean |
containsBean(java.lang.String name)
Checks whether a bean with the given name can be found in the default bean store of this bean context. |
|
boolean |
containsBean(java.lang.String name,
BeanStore store)
Checks whether a bean with the given name can be found in the specified bean store. |
|
|
getBean(java.lang.Class<T> beanCls)
Returns the bean with the given class starting the search with the default bean store. |
|
|
getBean(java.lang.Class<T> beanCls,
BeanStore store)
Returns the bean with the given class starting the search with the specified bean store. |
|
java.lang.Object |
getBean(java.lang.String name)
Returns the bean with the given name starting the search with the default bean store. |
|
java.lang.Object |
getBean(java.lang.String name,
BeanStore store)
Returns the bean with the given name starting the search with the specified bean store. |
|
BeanStore |
getDefaultBeanStore()
Returns the default bean store. |
|
BeanContext |
getWrappedContext()
Returns the wrapped bean context. |
|
void |
removeBeanCreationListener(BeanCreationListener l)
Removes the specified BeanCreationListener from this context. |
|
void |
setDefaultBeanStore(BeanStore store)
Sets the default bean store. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BeanContextWrapper(BeanContext wrappedContext)
BeanContextWrapper and sets the
wrapped context.
wrappedContext - the bean context to be wrapped (must not be
null)
java.lang.IllegalArgumentException - if the bean context is null
public BeanContextWrapper(BeanContext wrappedContext,
BeanStore defaultStore)
BeanContextWrapper and sets the
wrapped context and the default bean store.
wrappedContext - the bean context to be wrapped (must not be
null)defaultStore - the default bean store ton be used
java.lang.IllegalArgumentException - if the bean context is null| Method Detail |
|---|
public BeanContext getWrappedContext()
public java.util.Set<java.lang.Class<?>> beanClasses()
beanClasses in interface BeanContextpublic java.util.Set<java.lang.Class<?>> beanClasses(BeanStore store)
beanClasses in interface BeanContextstore - the bean store
public java.util.Set<java.lang.String> beanNames()
beanNames in interface BeanContextpublic java.util.Set<java.lang.String> beanNames(BeanStore store)
beanNames in interface BeanContextstore - the bean store
public boolean containsBean(java.lang.String name)
containsBean in interface BeanContextname - the name of the searched bean
public boolean containsBean(java.lang.String name,
BeanStore store)
containsBean in interface BeanContextname - the name of the beanstore - the bean store
public boolean containsBean(java.lang.Class<?> beanClass)
containsBean in interface BeanContextbeanClass - the class of the bean
public boolean containsBean(java.lang.Class<?> beanClass,
BeanStore store)
containsBean in interface BeanContextbeanClass - the class of the beanstore - the bean store
public java.lang.Object getBean(java.lang.String name)
getBean in interface BeanContextname - the name of the desired bean
public java.lang.Object getBean(java.lang.String name,
BeanStore store)
getBean in interface BeanContextname - the name of the desired beanstore - the bean store to start with
public <T> T getBean(java.lang.Class<T> beanCls)
getBean in interface BeanContextbeanCls - the class of the desired bean
public <T> T getBean(java.lang.Class<T> beanCls,
BeanStore store)
getBean in interface BeanContextbeanCls - the class of the desired beanstore - the store to start with
public java.lang.String beanNameFor(BeanProvider beanProvider)
BeanProvider starting the search
with the default bean store. This implementation delegates to the wrapped
context.
beanNameFor in interface BeanContextbeanProvider - the BeanProvider
BeanProvider or nullBeanContext.beanNameFor(BeanProvider, BeanStore)
public java.lang.String beanNameFor(BeanProvider beanProvider,
BeanStore store)
BeanProvider starting the search
with the specified bean store. This implementation delegates to the
wrapped context.
beanNameFor in interface BeanContextbeanProvider - the BeanProviderstore - the BeanStore
BeanProvider or nullpublic BeanStore getDefaultBeanStore()
getDefaultBeanStore in interface BeanContextpublic void setDefaultBeanStore(BeanStore store)
setDefaultBeanStore in interface BeanContextstore - the new default bean storepublic void addBeanCreationListener(BeanCreationListener l)
BeanCreationListener to this context. This
implementation ensures that events from the wrapped context are received.
However, the events are correctly transformed so that this context is set
as the source context of the event.
addBeanCreationListener in interface BeanContextl - the listener to be addedpublic void removeBeanCreationListener(BeanCreationListener l)
BeanCreationListener from this context.
removeBeanCreationListener in interface BeanContextl - the listener to be removedpublic void close()
BeanContext. This implementation removes the BeanCreationListener registered at the wrapped context. Note that the
wrapped context will not be closed! This is because the wrapped context
is typically shared.
close in interface BeanContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||