T - the bean-typepublic class BeansOfTypeDependency<T> extends java.lang.Object implements BeanDependency<java.util.List<T>>
BeanDependency to express a dependency on the beans of a certain type.
Be aware that this dependency cannot guarantee to provide all beans of that type, because the exact runtime
type of a bean and whether it is a subtype of the desired type cannot be determined before the bean's construction.
Hence this dependency always indicates to be unfulfilled, but optional. It
will gather as many beans as possible by obtaining the beans as late as possible.
BeanDependency.Fulfillment| Constructor and Description |
|---|
BeansOfTypeDependency(java.lang.Class<T> type)
Creates a new
BeansOfTypeDependency to beans of the given type. |
| Modifier and Type | Method and Description |
|---|---|
BeanDependency.Fulfillment |
fulfill(BeansProvider beansProvider)
Always returns
Fulfillment#UNFULFILLED_OPTIONAL, because it cannot be known if there will be any more
beans of the desired type defined in the future. |
java.util.List<T> |
get()
Obtains all beans of the desired type from the
BeansProvider this dependency was
fulfilled with. |
public BeansOfTypeDependency(java.lang.Class<T> type)
BeansOfTypeDependency to beans of the given type.type - the type of beanspublic BeanDependency.Fulfillment fulfill(BeansProvider beansProvider)
Fulfillment#UNFULFILLED_OPTIONAL, because it cannot be known if there will be any more
beans of the desired type defined in the future. The given BeansProvider will be used to obtain the beans
lazily when needed.fulfill in interface BeanDependency<java.util.List<T>>beansProvider - the BeansProvider to obtain beans fromBeanDependency.Fulfillmentpublic java.util.List<T> get()
BeansProvider this dependency was
fulfilled with.get in interface BeanDependency<java.util.List<T>>BeanDependency