Package io.smallrye.beanbag
Class BeanBag.Builder
- java.lang.Object
-
- io.smallrye.beanbag.BeanBag.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> BeanBag.BeanBuilder<T>addBean(Class<T> type)Add a new bean with the given type, returning a builder to configure it.<T> BeanBag.BuilderaddBeanInstance(T bean)Add a new bean which resolves to the given instance.BeanBagbuild()Build a new container instance with the beans that were previously configured in this builder.
-
-
-
Method Detail
-
addBean
public <T> BeanBag.BeanBuilder<T> addBean(Class<T> type)
Add a new bean with the given type, returning a builder to configure it. The given type must be the concrete type of the bean or a class representing a supertype of that concrete type.- Type Parameters:
T- the bean type- Parameters:
type- the bean type class (must not benull)- Returns:
- the bean builder (not
null)
-
addBeanInstance
public <T> BeanBag.Builder addBeanInstance(T bean)
Add a new bean which resolves to the given instance.- Type Parameters:
T- the bean type- Parameters:
bean- the bean instance (must not benull)- Returns:
- this builder (not
null)
-
build
public BeanBag build()
Build a new container instance with the beans that were previously configured in this builder.- Returns:
- the new container (not
null)
-
-