Class SynonymSetServiceClient (0.49.0)

GitHub RepositoryProduct Reference

Service Description: A Service that manage/custom customer specified SynonymSets.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(parent, synonymSet);
 }
 

Note: close() needs to be called on the SynonymSetServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

CreateSynonymSet

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createSynonymSet(CreateSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createSynonymSet(LocationName parent, SynonymSet synonymSet)

  • createSynonymSet(String parent, SynonymSet synonymSet)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createSynonymSetCallable()

GetSynonymSet

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getSynonymSet(GetSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getSynonymSet(SynonymSetName name)

  • getSynonymSet(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getSynonymSetCallable()

UpdateSynonymSet

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateSynonymSet(UpdateSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)

  • updateSynonymSet(String name, SynonymSet synonymSet)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateSynonymSetCallable()

DeleteSynonymSet

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteSynonymSet(DeleteSynonymSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteSynonymSet(SynonymSetName name)

  • deleteSynonymSet(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteSynonymSetCallable()

ListSynonymSets

Returns all SynonymSets (for all contexts) for the specified location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listSynonymSets(ListSynonymSetsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listSynonymSets(LocationName parent)

  • listSynonymSets(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listSynonymSetsPagedCallable()

  • listSynonymSetsCallable()

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of SynonymSetServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 SynonymSetServiceSettings synonymSetServiceSettings =
     SynonymSetServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SynonymSetServiceClient synonymSetServiceClient =
     SynonymSetServiceClient.create(synonymSetServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 SynonymSetServiceSettings synonymSetServiceSettings =
     SynonymSetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 SynonymSetServiceClient synonymSetServiceClient =
     SynonymSetServiceClient.create(synonymSetServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 SynonymSetServiceSettings synonymSetServiceSettings =
     SynonymSetServiceSettings.newHttpJsonBuilder().build();
 SynonymSetServiceClient synonymSetServiceClient =
     SynonymSetServiceClient.create(synonymSetServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > SynonymSetServiceClient

Static Methods

create()

public static final SynonymSetServiceClient create()

Constructs an instance of SynonymSetServiceClient with default settings.

Returns
Type Description
SynonymSetServiceClient
Exceptions
Type Description
IOException

create(SynonymSetServiceSettings settings)

public static final SynonymSetServiceClient create(SynonymSetServiceSettings settings)

Constructs an instance of SynonymSetServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings SynonymSetServiceSettings
Returns
Type Description
SynonymSetServiceClient
Exceptions
Type Description
IOException

create(SynonymSetServiceStub stub)

public static final SynonymSetServiceClient create(SynonymSetServiceStub stub)

Constructs an instance of SynonymSetServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SynonymSetServiceSettings).

Parameter
Name Description
stub SynonymSetServiceStub
Returns
Type Description
SynonymSetServiceClient

Constructors

SynonymSetServiceClient(SynonymSetServiceSettings settings)

protected SynonymSetServiceClient(SynonymSetServiceSettings settings)

Constructs an instance of SynonymSetServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings SynonymSetServiceSettings

SynonymSetServiceClient(SynonymSetServiceStub stub)

protected SynonymSetServiceClient(SynonymSetServiceStub stub)
Parameter
Name Description
stub SynonymSetServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createSynonymSet(CreateSynonymSetRequest request)

public final SynonymSet createSynonymSet(CreateSynonymSetRequest request)

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   CreateSynonymSetRequest request =
       CreateSynonymSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(request);
 }
 
Parameter
Name Description
request CreateSynonymSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SynonymSet

createSynonymSet(LocationName parent, SynonymSet synonymSet)

public final SynonymSet createSynonymSet(LocationName parent, SynonymSet synonymSet)

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(parent, synonymSet);
 }
 
Parameters
Name Description
parent LocationName

Required. The parent name. Format: projects/{project_number}/locations/{location}.

synonymSet SynonymSet

Required. The synonymSet to be created for a context

Returns
Type Description
SynonymSet

createSynonymSet(String parent, SynonymSet synonymSet)

public final SynonymSet createSynonymSet(String parent, SynonymSet synonymSet)

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.createSynonymSet(parent, synonymSet);
 }
 
Parameters
Name Description
parent String

Required. The parent name. Format: projects/{project_number}/locations/{location}.

synonymSet SynonymSet

Required. The synonymSet to be created for a context

Returns
Type Description
SynonymSet

createSynonymSetCallable()

public final UnaryCallable<CreateSynonymSetRequest,SynonymSet> createSynonymSetCallable()

Creates a SynonymSet for a single context. Throws an ALREADY_EXISTS exception if a synonymset already exists for the context.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   CreateSynonymSetRequest request =
       CreateSynonymSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.createSynonymSetCallable().futureCall(request);
   // Do something.
   SynonymSet response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateSynonymSetRequest,SynonymSet>

deleteSynonymSet(DeleteSynonymSetRequest request)

public final void deleteSynonymSet(DeleteSynonymSetRequest request)

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   DeleteSynonymSetRequest request =
       DeleteSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   synonymSetServiceClient.deleteSynonymSet(request);
 }
 
Parameter
Name Description
request DeleteSynonymSetRequest

The request object containing all of the parameters for the API call.

deleteSynonymSet(SynonymSetName name)

public final void deleteSynonymSet(SynonymSetName name)

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   SynonymSetName name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]");
   synonymSetServiceClient.deleteSynonymSet(name);
 }
 
Parameter
Name Description
name SynonymSetName

Required. The name of the synonymSet to delete Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

deleteSynonymSet(String name)

public final void deleteSynonymSet(String name)

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString();
   synonymSetServiceClient.deleteSynonymSet(name);
 }
 
Parameter
Name Description
name String

Required. The name of the synonymSet to delete Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

deleteSynonymSetCallable()

public final UnaryCallable<DeleteSynonymSetRequest,Empty> deleteSynonymSetCallable()

Deletes a SynonymSet for a given context. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   DeleteSynonymSetRequest request =
       DeleteSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   ApiFuture<Empty> future =
       synonymSetServiceClient.deleteSynonymSetCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteSynonymSetRequest,Empty>

getSettings()

public final SynonymSetServiceSettings getSettings()
Returns
Type Description
SynonymSetServiceSettings

getStub()

public SynonymSetServiceStub getStub()
Returns
Type Description
SynonymSetServiceStub

getSynonymSet(GetSynonymSetRequest request)

public final SynonymSet getSynonymSet(GetSynonymSetRequest request)

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   GetSynonymSetRequest request =
       GetSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   SynonymSet response = synonymSetServiceClient.getSynonymSet(request);
 }
 
Parameter
Name Description
request GetSynonymSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SynonymSet

getSynonymSet(SynonymSetName name)

public final SynonymSet getSynonymSet(SynonymSetName name)

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   SynonymSetName name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]");
   SynonymSet response = synonymSetServiceClient.getSynonymSet(name);
 }
 
Parameter
Name Description
name SynonymSetName

Required. The name of the synonymSet to retrieve Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

Returns
Type Description
SynonymSet

getSynonymSet(String name)

public final SynonymSet getSynonymSet(String name)

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString();
   SynonymSet response = synonymSetServiceClient.getSynonymSet(name);
 }
 
Parameter
Name Description
name String

Required. The name of the synonymSet to retrieve Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

Returns
Type Description
SynonymSet

getSynonymSetCallable()

public final UnaryCallable<GetSynonymSetRequest,SynonymSet> getSynonymSetCallable()

Gets a SynonymSet for a particular context. Throws a NOT_FOUND exception if the Synonymset does not exist

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   GetSynonymSetRequest request =
       GetSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.getSynonymSetCallable().futureCall(request);
   // Do something.
   SynonymSet response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetSynonymSetRequest,SynonymSet>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listSynonymSets(ListSynonymSetsRequest request)

public final SynonymSetServiceClient.ListSynonymSetsPagedResponse listSynonymSets(ListSynonymSetsRequest request)

Returns all SynonymSets (for all contexts) for the specified location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   ListSynonymSetsRequest request =
       ListSynonymSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (SynonymSet element : synonymSetServiceClient.listSynonymSets(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListSynonymSetsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SynonymSetServiceClient.ListSynonymSetsPagedResponse

listSynonymSets(LocationName parent)

public final SynonymSetServiceClient.ListSynonymSetsPagedResponse listSynonymSets(LocationName parent)

Returns all SynonymSets (for all contexts) for the specified location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (SynonymSet element : synonymSetServiceClient.listSynonymSets(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The parent name. Format: projects/{project_number}/locations/{location}.

Returns
Type Description
SynonymSetServiceClient.ListSynonymSetsPagedResponse

listSynonymSets(String parent)

public final SynonymSetServiceClient.ListSynonymSetsPagedResponse listSynonymSets(String parent)

Returns all SynonymSets (for all contexts) for the specified location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (SynonymSet element : synonymSetServiceClient.listSynonymSets(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent name. Format: projects/{project_number}/locations/{location}.

Returns
Type Description
SynonymSetServiceClient.ListSynonymSetsPagedResponse

listSynonymSetsCallable()

public final UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsResponse> listSynonymSetsCallable()

Returns all SynonymSets (for all contexts) for the specified location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   ListSynonymSetsRequest request =
       ListSynonymSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListSynonymSetsResponse response =
         synonymSetServiceClient.listSynonymSetsCallable().call(request);
     for (SynonymSet element : response.getSynonymSetsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsResponse>

listSynonymSetsPagedCallable()

public final UnaryCallable<ListSynonymSetsRequest,SynonymSetServiceClient.ListSynonymSetsPagedResponse> listSynonymSetsPagedCallable()

Returns all SynonymSets (for all contexts) for the specified location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   ListSynonymSetsRequest request =
       ListSynonymSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.listSynonymSetsPagedCallable().futureCall(request);
   // Do something.
   for (SynonymSet element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListSynonymSetsRequest,ListSynonymSetsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)

public final SynonymSet updateSynonymSet(SynonymSetName name, SynonymSet synonymSet)

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   SynonymSetName name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]");
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.updateSynonymSet(name, synonymSet);
 }
 
Parameters
Name Description
name SynonymSetName

Required. The name of the synonymSet to update Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

synonymSet SynonymSet

Required. The synonymSet to be updated for the customer

Returns
Type Description
SynonymSet

updateSynonymSet(UpdateSynonymSetRequest request)

public final SynonymSet updateSynonymSet(UpdateSynonymSetRequest request)

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   UpdateSynonymSetRequest request =
       UpdateSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   SynonymSet response = synonymSetServiceClient.updateSynonymSet(request);
 }
 
Parameter
Name Description
request UpdateSynonymSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SynonymSet

updateSynonymSet(String name, SynonymSet synonymSet)

public final SynonymSet updateSynonymSet(String name, SynonymSet synonymSet)

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   String name = SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString();
   SynonymSet synonymSet = SynonymSet.newBuilder().build();
   SynonymSet response = synonymSetServiceClient.updateSynonymSet(name, synonymSet);
 }
 
Parameters
Name Description
name String

Required. The name of the synonymSet to update Format: projects/{project_number}/locations/{location}/synonymSets/{context}.

synonymSet SynonymSet

Required. The synonymSet to be updated for the customer

Returns
Type Description
SynonymSet

updateSynonymSetCallable()

public final UnaryCallable<UpdateSynonymSetRequest,SynonymSet> updateSynonymSetCallable()

Remove the existing SynonymSet for the context and replaces it with a new one. Throws a NOT_FOUND exception if the SynonymSet is not found.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (SynonymSetServiceClient synonymSetServiceClient = SynonymSetServiceClient.create()) {
   UpdateSynonymSetRequest request =
       UpdateSynonymSetRequest.newBuilder()
           .setName(SynonymSetName.of("[PROJECT]", "[LOCATION]", "[CONTEXT]").toString())
           .setSynonymSet(SynonymSet.newBuilder().build())
           .build();
   ApiFuture<SynonymSet> future =
       synonymSetServiceClient.updateSynonymSetCallable().futureCall(request);
   // Do something.
   SynonymSet response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateSynonymSetRequest,SynonymSet>