public interface BeanLocator
Core interface for locating and discovering Bean
instances.
Modifier and Type | Method and Description |
---|---|
default <T> Optional<T> |
findBean(Argument<T> beanType)
Finds a Bean for the given type and qualifier.
|
<T> Optional<T> |
findBean(Argument<T> beanType,
Qualifier<T> qualifier)
Finds a Bean for the given type and qualifier.
|
default <T> Optional<T> |
findBean(Class<T> beanType)
Finds a Bean for the given type.
|
<T> Optional<T> |
findBean(Class<T> beanType,
Qualifier<T> qualifier)
Finds a Bean for the given type and qualifier.
|
default <T> Optional<T> |
findOrInstantiateBean(Class<T> beanType)
Finds a Bean for the given type or attempts to instantiate the given instance.
|
default <T> T |
getBean(Argument<T> beanType)
Obtains a Bean for the given type and qualifier.
|
default <T> T |
getBean(Argument<T> beanType,
Qualifier<T> qualifier)
Obtains a Bean for the given type and qualifier.
|
<T> T |
getBean(BeanDefinition<T> definition)
Obtains a Bean for the given bean definition.
|
default <T> T |
getBean(Class<T> beanType)
Obtains a Bean for the given type.
|
<T> T |
getBean(Class<T> beanType,
Qualifier<T> qualifier)
Obtains a Bean for the given type and qualifier.
|
default <T> Collection<T> |
getBeansOfType(Argument<T> beanType)
Get all beans of the given type.
|
default <T> Collection<T> |
getBeansOfType(Argument<T> beanType,
Qualifier<T> qualifier)
Get all beans of the given type.
|
<T> Collection<T> |
getBeansOfType(Class<T> beanType)
Get all beans of the given type.
|
<T> Collection<T> |
getBeansOfType(Class<T> beanType,
Qualifier<T> qualifier)
Get all beans of the given type.
|
default <T> T |
getProxyTargetBean(Argument<T> beanType,
Qualifier<T> qualifier)
Resolves the proxy target for a given bean type.
|
<T> T |
getProxyTargetBean(Class<T> beanType,
Qualifier<T> qualifier)
Resolves the proxy target for a given bean type.
|
default <T> Stream<T> |
streamOfType(Argument<T> beanType)
Obtain a stream of beans of the given type.
|
default <T> Stream<T> |
streamOfType(Argument<T> beanType,
Qualifier<T> qualifier)
Obtain a stream of beans of the given type.
|
default <T> Stream<T> |
streamOfType(Class<T> beanType)
Obtain a stream of beans of the given type.
|
<T> Stream<T> |
streamOfType(Class<T> beanType,
Qualifier<T> qualifier)
Obtain a stream of beans of the given type.
|
@NonNull <T> T getBean(@NonNull BeanDefinition<T> definition)
T
- The bean type parameterdefinition
- The bean typeNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull <T> T getBean(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean type parameterbeanType
- The bean typequalifier
- The qualifierNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull default <T> T getBean(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean type parameterbeanType
- The potentially parameterized bean typequalifier
- The qualifierNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull default <T> T getBean(@NonNull Argument<T> beanType)
T
- The bean type parameterbeanType
- The potentially parameterized bean typeNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull <T> Optional<T> findBean(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean type parameterbeanType
- The bean typequalifier
- The qualifierOptional
that is either empty or containing the specified beanNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull default <T> Optional<T> findBean(@NonNull Argument<T> beanType)
T
- The bean type parameterbeanType
- The bean typeOptional
that is either empty or containing the specified beanNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull <T> Optional<T> findBean(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean type parameterbeanType
- The bean typequalifier
- The qualifierOptional
that is either empty or containing the specified beanNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeQualifiers
@NonNull <T> Collection<T> getBeansOfType(@NonNull Class<T> beanType)
T
- The bean type parameterbeanType
- The bean type@NonNull <T> Collection<T> getBeansOfType(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean type parameterbeanType
- The bean typequalifier
- The qualifier@NonNull default <T> Collection<T> getBeansOfType(@NonNull Argument<T> beanType)
T
- The bean type parameterbeanType
- The potenitally parameterized bean type@NonNull default <T> Collection<T> getBeansOfType(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean type parameterbeanType
- The potenitally parameterized bean typequalifier
- The qualifier@NonNull <T> Stream<T> streamOfType(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean concrete typebeanType
- The bean typequalifier
- The qualifierQualifiers
@NonNull default <T> Stream<T> streamOfType(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The bean concrete typebeanType
- The potentially parameterized bean typequalifier
- The qualifierQualifiers
@NonNull default <T> Stream<T> streamOfType(@NonNull Argument<T> beanType)
T
- The bean concrete typebeanType
- The potentially parameterized bean typeQualifiers
@NonNull <T> T getProxyTargetBean(@NonNull Class<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The generic typebeanType
- The bean typequalifier
- The bean qualifier@NonNull default <T> T getProxyTargetBean(@NonNull Argument<T> beanType, @Nullable Qualifier<T> qualifier)
T
- The generic typebeanType
- The bean typequalifier
- The bean qualifier@NonNull default <T> Stream<T> streamOfType(@NonNull Class<T> beanType)
T
- The bean concrete typebeanType
- The bean type@NonNull default <T> T getBean(@NonNull Class<T> beanType)
T
- The bean type parameterbeanType
- The bean typeNonUniqueBeanException
- When multiple possible bean definitions exist
for the given typeNoSuchBeanException
- If the bean doesn't exist@NonNull default <T> Optional<T> findBean(@NonNull Class<T> beanType)
T
- The bean type parameterbeanType
- The bean typeOptional
that is either empty or containing the specified beanNonUniqueBeanException
- When multiple possible bean definitions exist
for the given type@NonNull default <T> Optional<T> findOrInstantiateBean(@NonNull Class<T> beanType)
T
- The bean type parameterbeanType
- The bean typeOptional
that is either empty or containing the specified bean if it could not
be found or instantiatedNonUniqueBeanException
- When multiple possible bean definitions exist
for the given type