Class DefaultDestinationLoader

java.lang.Object
com.sap.cloud.sdk.cloudplatform.connectivity.DefaultDestinationLoader
All Implemented Interfaces:
DestinationLoader

public final class DefaultDestinationLoader extends Object implements DestinationLoader
Default implementation of a DestinationLoader with convenience methods to add HTTP and RFC destinations.
  • Constructor Details

    • DefaultDestinationLoader

      public DefaultDestinationLoader()
  • Method Details

    • registerDestination

      @Nonnull public DefaultDestinationLoader registerDestination(@Nonnull Destination destination)
      Register a Destination to this destination loader. It must have a non-empty name to be identified by. If a destination with the same name was registered previously it will be replaced by this one.
      Parameters:
      destination - A destination this loader should return when queried.
      Returns:
      This loader instance.
      Throws:
      IllegalArgumentException - if the destination name is null or empty.
    • registerDestination

      @Nonnull public DefaultDestinationLoader registerDestination(@Nonnull HttpDestination destination)
      Register a HttpDestination to this destination loader. It must have a non-empty name to be identified by. If a destination with the same name was registered previously it will be replaced by this one.
      Parameters:
      destination - A destination this loader should return when queried.
      Returns:
      This loader instance.
      Throws:
      IllegalArgumentException - if the destination name is null or empty.
    • tryGetDestination

      @Nonnull public io.vavr.control.Try<Destination> tryGetDestination(@Nonnull String destinationName, @Nonnull DestinationOptions options)
      Description copied from interface: DestinationLoader
      Retrieves a destination for the given name and configuration options.

      The returned Try object will contain a DestinationNotFoundException in case the destination could not be found or a DestinationAccessException with more details in case something else went wrong.

      If the returned Try object contains no Exception it will always contain a non-null Destination value.

      Specified by:
      tryGetDestination in interface DestinationLoader
      Parameters:
      destinationName - The name of the destination to obtain.
      options - Additional settings to modify the behaviour of the destination loader.
      Returns:
      A Try object containing either the non-null Destination value or an exception.