- 0.47.0 (latest)
- 0.45.0
- 0.44.0
- 0.43.0
- 0.42.0
- 0.41.0
- 0.40.0
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.0
- 0.35.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
public class SynonymSetServiceClient implements BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
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.
Implements
BackgroundResourceStatic 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> |