T - The type of the referenced bean.public interface BeanReference<T>
passed a BeanResolver.| Modifier and Type | Method and Description |
|---|---|
default <U> BeanReference<? extends U> |
asSubTypeOf(Class<U> expectedType)
Cast this reference into a reference whose
resolve(BeanResolver) method is is guaranteed to
either fail or return an instance of the given type. |
static <T> BeanReference<T> |
of(Class<T> type)
Create a
BeanReference referencing a bean by its type only. |
static <T> BeanReference<T> |
of(Class<T> type,
String name)
Create a
BeanReference referencing a bean by type and name. |
static <T> BeanReference<T> |
ofInstance(T instance)
Create a
BeanReference referencing a bean instance directly. |
BeanHolder<T> |
resolve(BeanResolver beanResolver)
Resolve this reference into a bean using the given resolver.
|
BeanHolder<T> resolve(BeanResolver beanResolver)
beanResolver - A resolver to resolve this reference with.default <U> BeanReference<? extends U> asSubTypeOf(Class<U> expectedType)
resolve(BeanResolver) method is is guaranteed to
either fail or return an instance of the given type.U - The expected bean type.expectedType - The expected bean type.ClassCastException - If this reference is certain to never return an instance of the given type.static <T> BeanReference<T> of(Class<T> type)
BeanReference referencing a bean by its type only.T - The bean type.type - The bean type. Must not be null.BeanReference.static <T> BeanReference<T> of(Class<T> type, String name)
BeanReference referencing a bean by type and name.T - The bean type.type - The bean type. Must not be null.name - The bean name. May be null or empty.BeanReference.static <T> BeanReference<T> ofInstance(T instance)
BeanReference referencing a bean instance directly.T - The bean type.instance - The bean instance. Must not be null.BeanReference.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.