Package com.google.api.client.googleapis.services.protobuf (2.5.1)

com.google.api.client.util.Beta
Contains the basis for the generated service-specific libraries based on the Protobuf format.

Classes

AbstractGoogleProtoClient

Beta
Thread-safe Google protocol buffer client.

AbstractGoogleProtoClient.Builder

Beta
Builder for AbstractGoogleProtoClient.

Implementation is not thread-safe.

AbstractGoogleProtoClientRequest<T>

Beta
Google protocol buffer request for a AbstractGoogleProtoClient.

Implementation is not thread-safe.

CommonGoogleProtoClientRequestInitializer

Beta
Google protocol buffer client request initializer implementation for setting properties like key and userIp.

The simplest usage is to use it to set the key parameter:


 public static final GoogleClientRequestInitializer KEY_INITIALIZER =
   new CommonGoogleProtoClientRequestInitializer(KEY);
 

There is also a constructor to set both the key and userIp parameters:


 public static final GoogleClientRequestInitializer INITIALIZER =
   new CommonGoogleProtoClientRequestInitializer(KEY, USER_IP);
 

If you want to implement custom logic, extend it like this:


 public static class MyRequestInitializer extends CommonGoogleProtoClientRequestInitializer {

  {@literal @}Override
  public void initialize(AbstractGoogleProtoClientRequest{@literal <}?{@literal>} request)
      throws IOException {
      // custom logic
  }
 }
 

Finally, to set the key and userIp parameters and insert custom logic, extend it like this:


 public static class MyKeyRequestInitializer extends CommonGoogleProtoClientRequestInitializer {

   public MyKeyRequestInitializer() {
     super(KEY, USER_IP);
   }

   {@literal @}Override
   public void initializeProtoRequest(
     AbstractGoogleProtoClientRequest{@literal <}?{@literal>} request) throws IOException {
     // custom logic
   }
 }
 

Subclasses should be thread-safe.