Package io.smallrye.beanbag
Class BeanBag.Builder
java.lang.Object
io.smallrye.beanbag.BeanBag.Builder
- Enclosing class:
- BeanBag
A builder for a new container.
-
Method Summary
Modifier and TypeMethodDescription<T> BeanBag.BeanBuilder<T>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.build()Build a new container instance with the beans that were previously configured in this builder.excludePackage(String packageName) Exclude beans whose Java packages start with the value of the argument.includePackage(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 Details
-
excludePackage
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
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
-
addBean
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
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
Build a new container instance with the beans that were previously configured in this builder.- Returns:
- the new container (not
null)
-