All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.sdk.cloudplatform.connectivity.DestinationHeaderProvider Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
 */

package com.sap.cloud.sdk.cloudplatform.connectivity;

import java.util.List;
import java.util.stream.Collectors;

import javax.annotation.Nonnull;

import com.sap.cloud.sdk.cloudplatform.util.FacadeLocator;

/**
 * Allows to provide additional headers for a specific destination.
 */
public interface DestinationHeaderProvider
{
    /**
     * Provides a list of {@link Header} objects which should be used with the given destination.
     * 
     * @param destination
     *            The destination to provide additional headers for.
     * @return The headers to use with the given destination.
     */
    @Nonnull
    List
getHeaders( @Nonnull final Destination destination ); /** * Creates a list of all default headers to be used in the provided destination. *

* This is done by getting all registered implementations of the {@link DestinationHeaderProvider} interface, and * subsequently receiving all headers from these providers. * * @return An iterable list containing all headers that should be used on the provided destination. */ @Nonnull static Iterable

getDefaultHeaders( @Nonnull final Destination destination ) { return FacadeLocator .getFacades(DestinationHeaderProvider.class) .stream() .flatMap(destinationHeaderProvider -> destinationHeaderProvider.getHeaders(destination).stream()) .collect(Collectors.toList()); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy