Interface ServiceBindingDestinationLoader
- All Known Implementing Classes:
IdentityAuthenticationServiceBindingDestinationLoader
,MegacliteServiceBindingDestinationLoader
,OAuth2ServiceBindingDestinationLoader
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a class that is capable of transforming a
ServiceBinding
and
ServiceBindingDestinationOptions
into an HttpDestination
.- Since:
- 4.16.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the default loader chain instance.default HttpDestination
Tries to transform the givenoptions
into anHttpDestination
.newLoaderChain
(List<ServiceBindingDestinationLoader> delegateLoaders) Returns a new loader chain instance that will query the provideddelegateLoaders
in the provided order to try to transform the providedServiceBindingDestinationOptions
into anHttpDestination
.io.vavr.control.Try<HttpDestination>
-
Method Details
-
defaultLoaderChain
Returns the default loader chain instance. This instance will locate all availableServiceBindingDestinationLoader
implementations (using the service loader pattern) on the classpath. Those instances will be queried in no particular order to try to transform the providedServiceBindingDestinationOptions
into anHttpDestination
.- Returns:
- The default loader chain instance.
-
newLoaderChain
@Nonnull static ServiceBindingDestinationLoader newLoaderChain(@Nonnull List<ServiceBindingDestinationLoader> delegateLoaders) Returns a new loader chain instance that will query the provideddelegateLoaders
in the provided order to try to transform the providedServiceBindingDestinationOptions
into anHttpDestination
.- Parameters:
delegateLoaders
- TheServiceBindingDestinationLoader
instances that should be used.- Returns:
- A new loader chain instance.
-
tryGetDestination
@Nonnull io.vavr.control.Try<HttpDestination> tryGetDestination(@Nonnull ServiceBindingDestinationOptions options) - Parameters:
options
- TheServiceBindingDestinationOptions
that contain further context information about how the transformation process should be done.- Returns:
- Either a
Try.success(Object)
if the transformation succeeded,Try.failure(Throwable)
otherwise.In case of a
Try.failure(Throwable)
, the cause will either be aDestinationAccessException
or aDestinationNotFoundException
.
-
getDestination
@Nonnull default HttpDestination getDestination(@Nonnull ServiceBindingDestinationOptions options) throws DestinationAccessException, DestinationNotFoundException Tries to transform the givenoptions
into anHttpDestination
.This method is equivalent to
tryGetDestination(options).get();
.- Parameters:
options
- TheServiceBindingDestinationOptions
that contain further context information (such as theServiceBinding
that should be transformed) for the transformation process.- Returns:
- An
HttpDestination
that can be used to connect to be bound service. - Throws:
DestinationAccessException
- Thrown if the providedoptions
couldn't be transformed into anHttpDestination
.DestinationNotFoundException
- Thrown if noHttpDestination
could be found for the providedoptions
.
-