public class StandaloneBeanContext extends Object implements BeanContext
| Constructor and Description | 
|---|
| StandaloneBeanContext(ExecutionContext executionContext,
                     BeanIdStore beanIdStore,
                     Map<String,Object> beanMap)Create the StandAloneBeanContext | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addBean(BeanId beanId,
       Object bean)Add a bean instance under the specified  BeanId. | 
| void | addBean(BeanId beanId,
       Object bean,
       Fragment source)Add a bean instance under the specified beanId string. | 
| void | addBean(String beanId,
       Object bean)Add a bean instance under the specified beanId. | 
| void | addBean(String beanId,
       Object bean,
       Fragment source)Add a bean instance under the specified beanId. | 
| void | addObserver(BeanContextLifecycleObserver observer)Registers a bean context observer. | 
| void | changeBean(BeanId beanId,
          Object bean,
          Fragment source)Changes a bean instance of the given  BeanId. | 
| void | clear()Removes all the beans from the bean map | 
| boolean | containsBean(BeanId beanId)Looks if a bean instance is set under the  BeanId | 
| Object | getBean(BeanId beanId)Get the current bean, specified by the supplied  BeanId. | 
| <T> T | getBean(Class<T> beanType)Returns the bean by it's beanId name. | 
| static <T> T | getBean(Class<T> beanType,
       Map<String,Object> beanMap) | 
| Object | getBean(String beanId)Returns the bean by it's beanId name. | 
| BeanId | getBeanId(String beanId)Get the  BeanIdinstance for the specified beanId String. | 
| Map<String,Object> | getBeanMap()This returns a map which is backed by this repository. | 
| BeanContext | newSubContext(ExecutionContext executionContext) | 
| void | notifyObservers(BeanContextLifecycleEvent event)Notify all observers of a specific bean lifecycle event. | 
| Object | removeBean(BeanId beanId,
          Fragment source)Removes a bean and all its associated lifecycle beans from the bean map | 
| Object | removeBean(String beanId,
          Fragment source)Removes a bean and all its associated lifecycle beans from the bean map | 
| void | removeObserver(BeanContextLifecycleObserver observer)Unregisters a bean observer. | 
| void | setBeanInContext(BeanId beanId,
                boolean inContext)Mark the bean as being in context. | 
| String | toString() | 
public StandaloneBeanContext(ExecutionContext executionContext, BeanIdStore beanIdStore, Map<String,Object> beanMap)
executionContext - The ExecutionContext to which this object is bound to.beanIdStore - The BeanIdStore to which this object is bound to.beanMap - The Map in which the bean's will be set. It is
            important not to modify this map outside of the
            BeanRepository! It is only provided as constructor parameter
            because in some situations we need to control which
            Map is used.public void addBean(BeanId beanId, Object bean)
BeanContextBeanId.addBean in interface BeanContextbeanId - The BeanId under which the bean is to be stored.bean - The bean instance to be stored.public void addBean(BeanId beanId, Object bean, Fragment source)
BeanContextBeanId in the background.addBean in interface BeanContextbeanId - The BeanId under which the bean is to be stored.bean - The bean instance to be stored.source - Source fragment.public void addBean(String beanId, Object bean)
BeanContextBeanId instance
 for the beanId String and then use the BeanContext.addBean(BeanId, Object, Fragment) method.addBean in interface BeanContextbeanId - The beanId under which the bean is to be stored.bean - The bean instance to be stored.public void addBean(String beanId, Object bean, Fragment source)
BeanContextBeanId instance
 for the beanId String and then use the BeanContext.addBean(BeanId, Object, Fragment) method.addBean in interface BeanContextbeanId - The beanId under which the bean is to be stored.bean - The bean instance to be stored.source - Source fragment.public boolean containsBean(BeanId beanId)
BeanContextBeanIdcontainsBean in interface BeanContextbeanId - The BeanId under which is looked.public BeanId getBeanId(String beanId)
BeanContextBeanId instance for the specified beanId String.
 
 Regsiters the beanId if it's not already registered.getBeanId in interface BeanContextbeanId - The beanId String.BeanId instance.public Object getBean(BeanId beanId)
BeanContextBeanId.
 getBean in interface BeanContextbeanId - The BeanId of the bean to be returned.null.public Object getBean(String beanId)
BeanContextgetBean in interface BeanContextbeanId - The type of the bean to be returned.null.public <T> T getBean(Class<T> beanType)
BeanContextgetBean in interface BeanContextbeanType - The type of the bean to be returned.null.public void changeBean(BeanId beanId, Object bean, Fragment source)
BeanContextBeanId. The difference to BeanContext.addBean(BeanId, Object)
 is that the bean must exist, the associated beans aren't removed and the observers of the
 BeanLifecycle.CHANGE event are notified.changeBean in interface BeanContextbeanId - The BeanId under which the bean instance is to be stored.bean - The bean instance to be stored.source - Source fragment.public Object removeBean(BeanId beanId, Fragment source)
BeanContextremoveBean in interface BeanContextbeanId - The beanId to remove the beans from.source - Source fragment.public Object removeBean(String beanId, Fragment source)
BeanContextremoveBean in interface BeanContextbeanId - The beanId to remove the beans from.source - Source fragment.public void clear()
BeanContextclear in interface BeanContextpublic Map<String,Object> getBeanMap()
BeanContextgetBeanMap in interface BeanContextpublic void setBeanInContext(BeanId beanId, boolean inContext)
BeanContextsetBeanInContext in interface BeanContextbeanId - The bean ID.inContext - True if the bean is in context, otherwise false.public String toString()
toString in interface BeanContexttoString in class Objectpublic BeanContext newSubContext(ExecutionContext executionContext)
BeanContextnewSubContext in interface BeanContextexecutionContext - The Associated ExecutionContext.BeanContext.public void addObserver(BeanContextLifecycleObserver observer)
BeanContextaddObserver in interface BeanContextobserver - The actual BeanObserver instance.public void notifyObservers(BeanContextLifecycleEvent event)
BeanContextnotifyObservers in interface BeanContextevent - The event.public void removeObserver(BeanContextLifecycleObserver observer)
BeanContextremoveObserver in interface BeanContextobserver - The actual BeanObserver instance.Copyright © 2020. All rights reserved.