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

com.google.maps.clients.HttpRequestInitializerPipeline Maven / Gradle / Ivy

Go to download

Provides some extra sugar for the machine-generated Java library for Google Maps Engine. https://developers.google.com/api-client-library/java/apis/mapsengine/v1

There is a newer version: 0.2
Show newest version
package com.google.maps.clients;

import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestInitializer;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * Provides a mechanism for running multiple HttpRequestInitializers in sequence.
 *
 * @author [email protected] (Mark McDonald)
 */
public class HttpRequestInitializerPipeline implements HttpRequestInitializer {

  protected final List initializers;

  /**
   * Creates a new pipeline from the provided list of initializers.
   * @param existing The existing initializers are cloned, exactly like a new List<>(someList)
   */
  public HttpRequestInitializerPipeline(List existing) {
    initializers = new ArrayList(existing);
  }

  /**
   * Creates a new pipeline from the provided list of initializers.
   * @param initializers  The existing initializers to be used in the order specified.
   */
  public HttpRequestInitializerPipeline(HttpRequestInitializer... initializers) {
    this.initializers = Arrays.asList(initializers);
  }

  @Override
  public void initialize(HttpRequest httpRequest) throws IOException {
    for (HttpRequestInitializer initializer : initializers) {
      initializer.initialize(httpRequest);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy