Interface BootstrapRegistry.InstanceSupplier<T>
- Type Parameters:
T
- the instance type
- Enclosing interface:
BootstrapRegistry
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplier used to provide the actual instance when needed.
- Since:
- 2.4.0
- Author:
- Phillip Webb
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> BootstrapRegistry.InstanceSupplier
<T> Factory method that can be used to create anBootstrapRegistry.InstanceSupplier
from aSupplier
.@Nullable T
get
(BootstrapContext context) Factory method used to create the instance when needed.default BootstrapRegistry.Scope
getScope()
Return the scope of the supplied instance.static <T> BootstrapRegistry.InstanceSupplier
<T> of
(@Nullable T instance) Factory method that can be used to create anBootstrapRegistry.InstanceSupplier
for a given instance.default BootstrapRegistry.InstanceSupplier
<T> withScope
(BootstrapRegistry.Scope scope) Return a newBootstrapRegistry.InstanceSupplier
with an updatedBootstrapRegistry.Scope
.
-
Method Details
-
get
Factory method used to create the instance when needed.- Parameters:
context
- theBootstrapContext
which may be used to obtain other bootstrap instances.- Returns:
- the instance or
null
-
getScope
Return the scope of the supplied instance.- Returns:
- the scope
- Since:
- 2.4.2
-
withScope
Return a newBootstrapRegistry.InstanceSupplier
with an updatedBootstrapRegistry.Scope
.- Parameters:
scope
- the new scope- Returns:
- a new
BootstrapRegistry.InstanceSupplier
instance with the new scope - Since:
- 2.4.2
-
of
Factory method that can be used to create anBootstrapRegistry.InstanceSupplier
for a given instance.- Type Parameters:
T
- the instance type- Parameters:
instance
- the instance- Returns:
- a new
BootstrapRegistry.InstanceSupplier
-
from
Factory method that can be used to create anBootstrapRegistry.InstanceSupplier
from aSupplier
.- Type Parameters:
T
- the instance type- Parameters:
supplier
- the supplier that will provide the instance- Returns:
- a new
BootstrapRegistry.InstanceSupplier
-