Interface InstanceSupplier<T>
- Type Parameters:
- T- the type of instance supplied by this supplier
- All Superinterfaces:
- Supplier<T>, ThrowingSupplier<T>
- All Known Implementing Classes:
- BeanInstanceSupplier
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Specialized 
Supplier that can be set on a
BeanDefinition
when details about the registered bean are needed to
supply the instance.- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondefault <V> InstanceSupplier<V> andThen(ThrowingBiFunction<RegisteredBean, ? super T, ? extends V> after) Return a composed instance supplier that first obtains the instance from this supplier and then applies theafterfunction to obtain the result.get(RegisteredBean registeredBean) Get the supplied instance.Return the factory method that this supplier uses to create the instance, ornullif it is not known or this supplier uses another means.default TGets a result, possibly throwing a checked exception.static <T> InstanceSupplier<T> of(InstanceSupplier<T> instanceSupplier) Lambda friendly method that can be used to create anInstanceSupplierand add post processors in a single call.static <T> InstanceSupplier<T> using(@Nullable Method factoryMethod, ThrowingSupplier<T> supplier) Factory method to create anInstanceSupplierfrom aThrowingSupplier.static <T> InstanceSupplier<T> using(ThrowingSupplier<T> supplier) Factory method to create anInstanceSupplierfrom aThrowingSupplier.Methods inherited from interface ThrowingSupplierget, get, throwing
- 
Method Details- 
getWithExceptionDescription copied from interface:ThrowingSupplierGets a result, possibly throwing a checked exception.- Specified by:
- getWithExceptionin interface- ThrowingSupplier<T>
- Returns:
- a result
 
- 
getGet the supplied instance.- Parameters:
- registeredBean- the registered bean requesting the instance
- Returns:
- the supplied instance
- Throws:
- Exception- on error
 
- 
getFactoryMethod
- 
andThendefault <V> InstanceSupplier<V> andThen(ThrowingBiFunction<RegisteredBean, ? super T, ? extends V> after) Return a composed instance supplier that first obtains the instance from this supplier and then applies theafterfunction to obtain the result.- Type Parameters:
- V- the type of output of the- afterfunction, and of the composed function
- Parameters:
- after- the function to apply after the instance is obtained
- Returns:
- a composed instance supplier
 
- 
usingFactory method to create anInstanceSupplierfrom aThrowingSupplier.- Type Parameters:
- T- the type of instance supplied by this supplier
- Parameters:
- supplier- the source supplier
- Returns:
- a new InstanceSupplier
 
- 
usingFactory method to create anInstanceSupplierfrom aThrowingSupplier.- Type Parameters:
- T- the type of instance supplied by this supplier
- Parameters:
- factoryMethod- the factory method being used
- supplier- the source supplier
- Returns:
- a new InstanceSupplier
 
- 
ofLambda friendly method that can be used to create anInstanceSupplierand add post processors in a single call. For example:InstanceSupplier.of(registeredBean -> ...).andThen(...).- Type Parameters:
- T- the type of instance supplied by this supplier
- Parameters:
- instanceSupplier- the source instance supplier
- Returns:
- a new InstanceSupplier
 
 
-