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.BeanBag.BuilderexcludePackage(String packageName)Exclude beans whose Java packages start with the value of the argument.BeanBag.BuilderincludePackage(String packageName)Include beans whose Java packages start with the value of the argument, unless there is a matching exclude package filter.booleanisTypeFilteredOut(String type)
-
-
-
Method Detail
-
excludePackage
public BeanBag.Builder excludePackage(String packageName)
Exclude beans whose Java packages start with the value of the argument.- Parameters:
packageName- Java package name to exclude during bean discovery- Returns:
- this builder instance
-
includePackage
public BeanBag.Builder includePackage(String packageName)
Include beans whose Java packages start with the value of the argument, unless there is a matching exclude package filter. If inclusions weren't configured, all packages are assumed to be included.- Parameters:
packageName- Java package name to include during bean discovery- Returns:
- this builder instance
-
isTypeFilteredOut
public boolean isTypeFilteredOut(String type)
-
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)
-
-