| GitHub Repository | Product Reference |
Service Description: Provides methods for handling MobileCarrier objects.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
MobileCarrierName name = MobileCarrierName.of("[NETWORK_CODE]", "[MOBILE_CARRIER]");
MobileCarrier response = mobileCarrierServiceClient.getMobileCarrier(name);
}
Note: close() needs to be called on the MobileCarrierServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetMobileCarrier |
API to retrieve a |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListMobileCarriers |
API to retrieve a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return 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 MobileCarrierServiceSettings 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
MobileCarrierServiceSettings mobileCarrierServiceSettings =
MobileCarrierServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create(mobileCarrierServiceSettings);
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
MobileCarrierServiceSettings mobileCarrierServiceSettings =
MobileCarrierServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create(mobileCarrierServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final MobileCarrierServiceClient create()Constructs an instance of MobileCarrierServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(MobileCarrierServiceSettings settings)
public static final MobileCarrierServiceClient create(MobileCarrierServiceSettings settings)Constructs an instance of MobileCarrierServiceClient, 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 |
MobileCarrierServiceSettings |
| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(MobileCarrierServiceStub stub)
public static final MobileCarrierServiceClient create(MobileCarrierServiceStub stub)Constructs an instance of MobileCarrierServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(MobileCarrierServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
MobileCarrierServiceStub |
| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceClient |
|
Constructors
MobileCarrierServiceClient(MobileCarrierServiceSettings settings)
protected MobileCarrierServiceClient(MobileCarrierServiceSettings settings)Constructs an instance of MobileCarrierServiceClient, 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 |
MobileCarrierServiceSettings |
MobileCarrierServiceClient(MobileCarrierServiceStub stub)
protected MobileCarrierServiceClient(MobileCarrierServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
MobileCarrierServiceStub |
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()getMobileCarrier(GetMobileCarrierRequest request)
public final MobileCarrier getMobileCarrier(GetMobileCarrierRequest request)API to retrieve a MobileCarrier object.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
GetMobileCarrierRequest request =
GetMobileCarrierRequest.newBuilder()
.setName(MobileCarrierName.of("[NETWORK_CODE]", "[MOBILE_CARRIER]").toString())
.build();
MobileCarrier response = mobileCarrierServiceClient.getMobileCarrier(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetMobileCarrierRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
MobileCarrier |
|
getMobileCarrier(MobileCarrierName name)
public final MobileCarrier getMobileCarrier(MobileCarrierName name)API to retrieve a MobileCarrier object.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
MobileCarrierName name = MobileCarrierName.of("[NETWORK_CODE]", "[MOBILE_CARRIER]");
MobileCarrier response = mobileCarrierServiceClient.getMobileCarrier(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
MobileCarrierNameRequired. The resource name of the MobileCarrier. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileCarrier |
|
getMobileCarrier(String name)
public final MobileCarrier getMobileCarrier(String name)API to retrieve a MobileCarrier object.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
String name = MobileCarrierName.of("[NETWORK_CODE]", "[MOBILE_CARRIER]").toString();
MobileCarrier response = mobileCarrierServiceClient.getMobileCarrier(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the MobileCarrier. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileCarrier |
|
getMobileCarrierCallable()
public final UnaryCallable<GetMobileCarrierRequest,MobileCarrier> getMobileCarrierCallable()API to retrieve a MobileCarrier object.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
GetMobileCarrierRequest request =
GetMobileCarrierRequest.newBuilder()
.setName(MobileCarrierName.of("[NETWORK_CODE]", "[MOBILE_CARRIER]").toString())
.build();
ApiFuture<MobileCarrier> future =
mobileCarrierServiceClient.getMobileCarrierCallable().futureCall(request);
// Do something.
MobileCarrier response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetMobileCarrierRequest,MobileCarrier> |
|
getSettings()
public final MobileCarrierServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceSettings |
|
getStub()
public MobileCarrierServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listMobileCarriers(ListMobileCarriersRequest request)
public final MobileCarrierServiceClient.ListMobileCarriersPagedResponse listMobileCarriers(ListMobileCarriersRequest request)API to retrieve a list of MobileCarrier objects.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
ListMobileCarriersRequest request =
ListMobileCarriersRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (MobileCarrier element :
mobileCarrierServiceClient.listMobileCarriers(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListMobileCarriersRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceClient.ListMobileCarriersPagedResponse |
|
listMobileCarriers(NetworkName parent)
public final MobileCarrierServiceClient.ListMobileCarriersPagedResponse listMobileCarriers(NetworkName parent)API to retrieve a list of MobileCarrier objects.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (MobileCarrier element :
mobileCarrierServiceClient.listMobileCarriers(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. The parent, which owns this collection of MobileCarriers. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceClient.ListMobileCarriersPagedResponse |
|
listMobileCarriers(String parent)
public final MobileCarrierServiceClient.ListMobileCarriersPagedResponse listMobileCarriers(String parent)API to retrieve a list of MobileCarrier objects.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (MobileCarrier element :
mobileCarrierServiceClient.listMobileCarriers(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of MobileCarriers. Format:
|
| Returns | |
|---|---|
| Type | Description |
MobileCarrierServiceClient.ListMobileCarriersPagedResponse |
|
listMobileCarriersCallable()
public final UnaryCallable<ListMobileCarriersRequest,ListMobileCarriersResponse> listMobileCarriersCallable()API to retrieve a list of MobileCarrier objects.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
ListMobileCarriersRequest request =
ListMobileCarriersRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListMobileCarriersResponse response =
mobileCarrierServiceClient.listMobileCarriersCallable().call(request);
for (MobileCarrier element : response.getMobileCarriersList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListMobileCarriersRequest,ListMobileCarriersResponse> |
|
listMobileCarriersPagedCallable()
public final UnaryCallable<ListMobileCarriersRequest,MobileCarrierServiceClient.ListMobileCarriersPagedResponse> listMobileCarriersPagedCallable()API to retrieve a list of MobileCarrier objects.
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 (MobileCarrierServiceClient mobileCarrierServiceClient =
MobileCarrierServiceClient.create()) {
ListMobileCarriersRequest request =
ListMobileCarriersRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<MobileCarrier> future =
mobileCarrierServiceClient.listMobileCarriersPagedCallable().futureCall(request);
// Do something.
for (MobileCarrier element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListMobileCarriersRequest,ListMobileCarriersPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()