Send feedback
Class ServiceOptions<ServiceT,OptionsT> (2.5.11)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.5.11 keyboard_arrow_down
public abstract class ServiceOptions<ServiceT , OptionsT > implements Serializable
Abstract class representing service options.
Type Parameters
Name Description ServiceT OptionsT
Static Fields
CREDENTIAL_ENV_NAME
public static final String CREDENTIAL_ENV_NAME
Field Value
Static Methods
<T>getFromServiceLoader(Class<? extends T> clazz, T defaultInstance)
public static T <T>getFromServiceLoader ( Class <? extends T > clazz , T defaultInstance )
Parameters
Name Description clazz Class <? extends T >
defaultInstance T
Returns
<T>newInstance(String className)
public static T <T>newInstance ( String className )
Parameter
Name Description className String
Returns
Exceptions
getAppEngineAppId()
public static String getAppEngineAppId ()
Returns
getAppEngineProjectId()
protected static String getAppEngineProjectId ()
Returns
getAppEngineProjectIdFromAppId()
protected static String getAppEngineProjectIdFromAppId ()
Returns
getDefaultProjectId()
public static String getDefaultProjectId ()
Returns the default project ID, or null
if no default project ID could be found. This
method returns the first available project ID among the following sources:
The project ID specified by the GOOGLE_CLOUD_PROJECT environment variable
The App Engine project ID
The project ID specified in the JSON credentials file pointed by the
GOOGLE_APPLICATION_CREDENTIALS
environment variable
The Google Cloud SDK project ID
The Compute Engine project ID
Returns
getDefaultRetrySettings()
public static RetrySettings getDefaultRetrySettings ()
Returns
getGoogApiClientLibName()
public static String getGoogApiClientLibName ()
Returns the library's name used by x-goog-api-client header as a string.
Returns
getGoogleCloudProjectId()
protected static String getGoogleCloudProjectId ()
Returns
getLibraryName()
public static String getLibraryName ()
Returns the library's name, gcloud-java
, as a string.
Returns
getNoRetrySettings()
public static RetrySettings getNoRetrySettings ()
Returns
getServiceAccountProjectId()
protected static String getServiceAccountProjectId ()
Returns
Constructors
ServiceOptions(Class<? extends ServiceFactory<ServiceT,OptionsT>> serviceFactoryClass, Class<? extends ServiceRpcFactory<OptionsT>> rpcFactoryClass, ServiceOptions.Builder<ServiceT,OptionsT,?> builder, ServiceDefaults<ServiceT,OptionsT> serviceDefaults)
protected ServiceOptions ( Class <? extends ServiceFactory<ServiceT , OptionsT >> serviceFactoryClass , Class <? extends ServiceRpcFactory<OptionsT> > rpcFactoryClass , ServiceOptions . Builder<ServiceT , OptionsT , ? > builder , ServiceDefaults<ServiceT , OptionsT > serviceDefaults )
Parameters
Name Description serviceFactoryClass Class <? extends com.google.cloud.ServiceFactory <ServiceT ,OptionsT >>
rpcFactoryClass Class <? extends com.google.cloud.spi.ServiceRpcFactory <OptionsT >>
builder Builder <ServiceT ,OptionsT ,? >
serviceDefaults ServiceDefaults <ServiceT ,OptionsT >
Fields
clientLibToken
protected final String clientLibToken
Field Value
credentials
protected Credentials credentials
Field Value
Type Description com.google.auth.Credentials
Methods
<B>toBuilder()
public abstract B <B>toBuilder ()
Returns
baseEquals(ServiceOptions<?,?> other)
protected boolean baseEquals ( ServiceOptions <? , ? > other )
Parameter
Returns
baseHashCode()
protected int baseHashCode ()
Returns
defaultRetrySettings()
protected RetrySettings defaultRetrySettings ()
Some services may have different backoff requirements listed in their SLAs. Be sure to override
this method in options subclasses when the service's backoff requirement differs from the
default parameters listed in RetrySettings .
Returns
getApplicationName()
public String getApplicationName ()
Returns the application's name as a string in the format gcloud-java/[version]
,
optionally prepended with externally supplied User-Agent header value (via setting custom
header provider).
Returns
getClientLibToken()
public String getClientLibToken ()
Returns
getClock()
public ApiClock getClock ()
Returns the service's clock. Default time source uses System#currentTimeMillis() to get
current time.
Returns
getCredentials()
public Credentials getCredentials ()
Returns the authentication credentials.
Returns
Type Description com.google.auth.Credentials
getDefaultHost()
protected String getDefaultHost ()
Returns
getDefaultProject()
protected String getDefaultProject ()
Returns
getHost()
Returns the service host.
Returns
getLibraryVersion()
public String getLibraryVersion ()
Returns the library's version as a string.
Returns
public final HeaderProvider getMergedHeaderProvider ( HeaderProvider internalHeaderProvider )
Parameter
Returns
getProjectId()
public String getProjectId ()
Returns the project ID. Return value can be null (for services that don't require a project
ID).
Returns
getQuotaProjectId()
public String getQuotaProjectId ()
Returns the quotaProjectId that specifies the project used for quota and billing purposes.
Returns
getRetrySettings()
public RetrySettings getRetrySettings ()
Returns configuration parameters for request retries.
Returns
getRpc()
public ServiceRpc getRpc ()
Returns a Service RPC object for the current service. For instance, when using Google Cloud
Storage, it returns a StorageRpc object.
Returns
getScopedCredentials()
public Credentials getScopedCredentials ()
Returns the authentication credentials. If required, credentials are scoped.
Returns
Type Description com.google.auth.Credentials
getScopes()
protected abstract Set<String> getScopes ()
Returns
getService()
public ServiceT getService ()
Returns a Service object for the current service. For instance, when using Google Cloud
Storage, it returns a Storage object.
Returns
getTransportOptions()
public TransportOptions getTransportOptions ()
Returns the transport-specific options for this service.
Returns
getUserAgent()
public final String getUserAgent ()
Returns
projectIdRequired()
protected boolean projectIdRequired ()
Returns whether a service requires a project ID. This method may be overridden in
service-specific Options objects.
Returns
Type Description boolean true if a project ID is required to use the service, false if not
shouldRefreshRpc(ServiceRpc cachedRpc)
protected boolean shouldRefreshRpc ( ServiceRpc cachedRpc )
Parameter
Name Description cachedRpc ServiceRpc
The currently cached service object
Returns
Type Description boolean true if the currently cached service object should be refreshed.
shouldRefreshService(ServiceT cachedService)
protected boolean shouldRefreshService ( ServiceT cachedService )
Parameter
Name Description cachedService ServiceT
The currently cached service object
Returns
Type Description boolean true if the currently cached service object should be refreshed.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-26 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-26 UTC."],[],[]]