- java.lang.Object
-
- io.avaje.inject.spi.SuppliedBean
-
public class SuppliedBean extends Object
Holds beans supplied to the dependency injection.These can be externally supplied dependencies or test doubles for testing purposes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>[]interfaces()Return the interfaces to additionally register along with the type.Stringname()Return the qualifier name of the supplied bean.static SuppliedBeanof(Class<?> type, Object source)Create with a class type and bean instance.static <B> SuppliedBeanof(String name, Class<B> type, B source)Create for a class type with name.static <B> SuppliedBeanof(String name, Class<B> type, Consumer<B> consumer)Create for a class type with a consumer that runs once when the bean is obtained.static SuppliedBeanofType(String name, Type type, Object source)Create a supplied bean for a generic type.intpriority()Return the associated priority.static SuppliedBeansecondary(String name, Type type, Object source)Create a supplied bean with SECONDARY priority as a default fallback dependency that is only used when no other matching one is provided.Objectsource()Return the bean instance or provider to use for injection.Typetype()Return the dependency injection target type.
-
-
-
Method Detail
-
of
public static SuppliedBean of(Class<?> type, Object source)
Create with a class type and bean instance.
-
of
public static <B> SuppliedBean of(String name, Class<B> type, Consumer<B> consumer)
Create for a class type with a consumer that runs once when the bean is obtained.
-
of
public static <B> SuppliedBean of(String name, Class<B> type, B source)
Create for a class type with name.
-
ofType
public static SuppliedBean ofType(String name, Type type, Object source)
Create a supplied bean for a generic type.
-
secondary
public static SuppliedBean secondary(String name, Type type, Object source)
Create a supplied bean with SECONDARY priority as a default fallback dependency that is only used when no other matching one is provided.
-
priority
public final int priority()
Return the associated priority.
-
interfaces
public final Class<?>[] interfaces()
Return the interfaces to additionally register along with the type.
-
-