public class DefaultInjectionContext extends Object implements InjectionContext
InjectionContext.| Constructor and Description |
|---|
DefaultInjectionContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
freeze()
Freezes current context, so there will be no possibility to modify this context.
|
<T> T |
getBean(Class<T> beanClass)
Gets bean associated with the class given.
|
<T> List<T> |
getBeans(Class<T> beanClass)
Returns all the beans that implement the given class.
|
boolean |
isFrozen() |
<T> void |
registerBean(Class<T> beanClass)
Puts bean instance associated with the given class.
|
<T> void |
registerBean(T bean)
Puts bean instance to the context.
|
public <T> void registerBean(@Nonnull T bean)
InjectionContextregisterBean in interface InjectionContextT - Bean's class.bean - Bean instance.public <T> void registerBean(@Nonnull Class<T> beanClass)
InjectionContextInjectionException if the given bean class clashes with certain existing definition.registerBean in interface InjectionContextT - Bean class type.beanClass - Non-interface bean class.@Nonnull public <T> T getBean(@Nonnull Class<T> beanClass)
InjectionContextInjectionException in case of no bean associated with the given class.
Throws InjectionException if multiple beans can be returned by this method.getBean in interface InjectionContextT - Interface type.beanClass - Interface class, that is expected to be associated with the bean.@Nonnull public <T> List<T> getBeans(@Nonnull Class<T> beanClass)
InjectionContextgetBeans in interface InjectionContextT - Interface type.beanClass - Interface class, that is expected to be associated with the bean.public void freeze()
InjectionContextfreeze in interface InjectionContextInjectionContext.isFrozen()public boolean isFrozen()
isFrozen in interface InjectionContextInjectionContext.freeze()Copyright © 2011–2014. All rights reserved.