Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit e032e57

Browse files
committed
fix format
1 parent 4b6b412 commit e032e57

6 files changed

Lines changed: 101 additions & 121 deletions

File tree

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClient.java

Lines changed: 70 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import com.google.api.gax.rpc.NotFoundException;
2525
import com.google.bigtable.admin.v2.DeleteAuthorizedViewRequest;
2626
import com.google.bigtable.admin.v2.DeleteBackupRequest;
27+
import com.google.bigtable.admin.v2.DeleteSchemaBundleRequest;
2728
import com.google.bigtable.admin.v2.DeleteTableRequest;
2829
import com.google.bigtable.admin.v2.DropRowRangeRequest;
29-
import com.google.bigtable.admin.v2.DeleteSchemaBundleRequest;
3030
import com.google.bigtable.admin.v2.GetAuthorizedViewRequest;
3131
import com.google.bigtable.admin.v2.GetBackupRequest;
3232
import com.google.bigtable.admin.v2.GetSchemaBundleRequest;
@@ -1808,8 +1808,7 @@ public ApiFuture<Void> deleteAuthorizedViewAsync(String tableId, String authoriz
18081808
/**
18091809
* Creates a new schema bundle with the specified configuration.
18101810
*
1811-
* <p>
1812-
* Sample code:
1811+
* <p>Sample code:
18131812
*
18141813
* <pre>{@code
18151814
* CreateSchemaBundleRequest request = CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
@@ -1832,8 +1831,7 @@ public SchemaBundle createSchemaBundle(CreateSchemaBundleRequest request) {
18321831
/**
18331832
* Asynchronously creates a new schema bundle with the specified configuration.
18341833
*
1835-
* <p>
1836-
* Sample code:
1834+
* <p>Sample code:
18371835
*
18381836
* <pre>{@code
18391837
* CreateSchemaBundleRequest request = CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
@@ -1868,8 +1866,7 @@ public ApiFuture<SchemaBundle> createSchemaBundleAsync(CreateSchemaBundleRequest
18681866
.futureCall(request.toProto(projectId, instanceId)),
18691867
new ApiFunction<com.google.bigtable.admin.v2.SchemaBundle, SchemaBundle>() {
18701868
@Override
1871-
public SchemaBundle apply(
1872-
com.google.bigtable.admin.v2.SchemaBundle schemaBundleProto) {
1869+
public SchemaBundle apply(com.google.bigtable.admin.v2.SchemaBundle schemaBundleProto) {
18731870
return SchemaBundle.fromProto(schemaBundleProto);
18741871
}
18751872
},
@@ -1879,8 +1876,7 @@ public SchemaBundle apply(
18791876
/**
18801877
* Updates an existing schema bundle with the specified configuration.
18811878
*
1882-
* <p>
1883-
* Sample code:
1879+
* <p>Sample code:
18841880
*
18851881
* <pre>{@code
18861882
* SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
@@ -1897,11 +1893,9 @@ public SchemaBundle updateSchemaBundle(UpdateSchemaBundleRequest request) {
18971893
}
18981894

18991895
/**
1900-
* Asynchronously updates an existing schema bundle with the specified
1901-
* configuration.
1896+
* Asynchronously updates an existing schema bundle with the specified configuration.
19021897
*
1903-
* <p>
1904-
* Sample code:
1898+
* <p>Sample code:
19051899
*
19061900
* <pre>{@code
19071901
* SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
@@ -1932,20 +1926,17 @@ public ApiFuture<SchemaBundle> updateSchemaBundleAsync(UpdateSchemaBundleRequest
19321926
.futureCall(request.toProto(projectId, instanceId)),
19331927
new ApiFunction<com.google.bigtable.admin.v2.SchemaBundle, SchemaBundle>() {
19341928
@Override
1935-
public SchemaBundle apply(
1936-
com.google.bigtable.admin.v2.SchemaBundle schemaBundleProto) {
1929+
public SchemaBundle apply(com.google.bigtable.admin.v2.SchemaBundle schemaBundleProto) {
19371930
return SchemaBundle.fromProto(schemaBundleProto);
19381931
}
19391932
},
19401933
MoreExecutors.directExecutor());
19411934
}
19421935

19431936
/**
1944-
* Gets an schema bundle with the specified schema bundle ID in the specified
1945-
* table.
1937+
* Gets an schema bundle with the specified schema bundle ID in the specified table.
19461938
*
1947-
* <p>
1948-
* Sample code:
1939+
* <p>Sample code:
19491940
*
19501941
* <pre>{@code
19511942
* SchemaBundle schemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
@@ -1957,12 +1948,10 @@ public SchemaBundle getSchemaBundle(String tableId, String schemaBundleId) {
19571948
}
19581949

19591950
/**
1960-
* Asynchronously gets an schema bundle with the specified schema bundle ID in
1961-
* the specified
1951+
* Asynchronously gets an schema bundle with the specified schema bundle ID in the specified
19621952
* table.
19631953
*
1964-
* <p>
1965-
* Sample code:
1954+
* <p>Sample code:
19661955
*
19671956
* <pre>{@code
19681957
* ApiFuture<SchemaBundle> future = client.getSchemaBundleAsync("my-table", "my-schema-bundle");
@@ -1982,16 +1971,16 @@ public SchemaBundle getSchemaBundle(String tableId, String schemaBundleId) {
19821971
* }</pre>
19831972
*/
19841973
public ApiFuture<SchemaBundle> getSchemaBundleAsync(String tableId, String schemaBundleId) {
1985-
GetSchemaBundleRequest request = GetSchemaBundleRequest.newBuilder()
1986-
.setName(
1987-
NameUtil.formatSchemaBundleName(projectId, instanceId, tableId, schemaBundleId))
1988-
.build();
1974+
GetSchemaBundleRequest request =
1975+
GetSchemaBundleRequest.newBuilder()
1976+
.setName(
1977+
NameUtil.formatSchemaBundleName(projectId, instanceId, tableId, schemaBundleId))
1978+
.build();
19891979
return ApiFutures.transform(
19901980
stub.getSchemaBundleCallable().futureCall(request),
19911981
new ApiFunction<com.google.bigtable.admin.v2.SchemaBundle, SchemaBundle>() {
19921982
@Override
1993-
public SchemaBundle apply(
1994-
com.google.bigtable.admin.v2.SchemaBundle schemaBundleProto) {
1983+
public SchemaBundle apply(com.google.bigtable.admin.v2.SchemaBundle schemaBundleProto) {
19951984
return SchemaBundle.fromProto(schemaBundleProto);
19961985
}
19971986
},
@@ -2001,8 +1990,7 @@ public SchemaBundle apply(
20011990
/**
20021991
* Lists all schema bundle IDs in the specified table.
20031992
*
2004-
* <p>
2005-
* Sample code:
1993+
* <p>Sample code:
20061994
*
20071995
* <pre>{@code
20081996
* List<String> schemaBundles = client.listSchemaBundles("my-table");
@@ -2015,8 +2003,7 @@ public List<String> listSchemaBundles(String tableId) {
20152003
/**
20162004
* Asynchronously lists all schema bundle IDs in the specified table.
20172005
*
2018-
* <p>
2019-
* Sample code:
2006+
* <p>Sample code:
20202007
*
20212008
* <pre>{@code
20222009
* ApiFuture<List<String>> future = client.listSchemaBundlesAsync("my-table");
@@ -2039,48 +2026,53 @@ public List<String> listSchemaBundles(String tableId) {
20392026
* }</pre>
20402027
*/
20412028
public ApiFuture<List<String>> listSchemaBundlesAsync(String tableId) {
2042-
ListSchemaBundlesRequest request = ListSchemaBundlesRequest.newBuilder()
2043-
.setParent(NameUtil.formatTableName(projectId, instanceId, tableId))
2044-
.build();
2029+
ListSchemaBundlesRequest request =
2030+
ListSchemaBundlesRequest.newBuilder()
2031+
.setParent(NameUtil.formatTableName(projectId, instanceId, tableId))
2032+
.build();
20452033

20462034
// TODO(igorbernstein2): try to upstream pagination spooling or figure out a way
20472035
// to expose the
20482036
// paginated responses while maintaining the wrapper facade.
20492037

20502038
// Fetches the first page.
2051-
ApiFuture<ListSchemaBundlesPage> firstPageFuture = ApiFutures.transform(
2052-
stub.listSchemaBundlesPagedCallable().futureCall(request),
2053-
new ApiFunction<ListSchemaBundlesPagedResponse, ListSchemaBundlesPage>() {
2054-
@Override
2055-
public ListSchemaBundlesPage apply(ListSchemaBundlesPagedResponse response) {
2056-
return response.getPage();
2057-
}
2058-
},
2059-
MoreExecutors.directExecutor());
2039+
ApiFuture<ListSchemaBundlesPage> firstPageFuture =
2040+
ApiFutures.transform(
2041+
stub.listSchemaBundlesPagedCallable().futureCall(request),
2042+
new ApiFunction<ListSchemaBundlesPagedResponse, ListSchemaBundlesPage>() {
2043+
@Override
2044+
public ListSchemaBundlesPage apply(ListSchemaBundlesPagedResponse response) {
2045+
return response.getPage();
2046+
}
2047+
},
2048+
MoreExecutors.directExecutor());
20602049

20612050
// Fetches the rest of the pages by chaining the futures.
2062-
ApiFuture<List<com.google.bigtable.admin.v2.SchemaBundle>> allProtos = ApiFutures.transformAsync(
2063-
firstPageFuture,
2064-
new ApiAsyncFunction<ListSchemaBundlesPage, List<com.google.bigtable.admin.v2.SchemaBundle>>() {
2065-
List<com.google.bigtable.admin.v2.SchemaBundle> responseAccumulator = Lists.newArrayList();
2051+
ApiFuture<List<com.google.bigtable.admin.v2.SchemaBundle>> allProtos =
2052+
ApiFutures.transformAsync(
2053+
firstPageFuture,
2054+
new ApiAsyncFunction<
2055+
ListSchemaBundlesPage, List<com.google.bigtable.admin.v2.SchemaBundle>>() {
2056+
List<com.google.bigtable.admin.v2.SchemaBundle> responseAccumulator =
2057+
Lists.newArrayList();
20662058

2067-
@Override
2068-
public ApiFuture<List<com.google.bigtable.admin.v2.SchemaBundle>> apply(
2069-
ListSchemaBundlesPage page) {
2070-
// Add all entries from the page
2071-
responseAccumulator.addAll(Lists.newArrayList(page.getValues()));
2072-
2073-
// If this is the last page, just return the accumulated responses.
2074-
if (!page.hasNextPage()) {
2075-
return ApiFutures.immediateFuture(responseAccumulator);
2076-
}
2059+
@Override
2060+
public ApiFuture<List<com.google.bigtable.admin.v2.SchemaBundle>> apply(
2061+
ListSchemaBundlesPage page) {
2062+
// Add all entries from the page
2063+
responseAccumulator.addAll(Lists.newArrayList(page.getValues()));
20772064

2078-
// Otherwise fetch the next page.
2079-
return ApiFutures.transformAsync(
2080-
page.getNextPageAsync(), this, MoreExecutors.directExecutor());
2081-
}
2082-
},
2083-
MoreExecutors.directExecutor());
2065+
// If this is the last page, just return the accumulated responses.
2066+
if (!page.hasNextPage()) {
2067+
return ApiFutures.immediateFuture(responseAccumulator);
2068+
}
2069+
2070+
// Otherwise fetch the next page.
2071+
return ApiFutures.transformAsync(
2072+
page.getNextPageAsync(), this, MoreExecutors.directExecutor());
2073+
}
2074+
},
2075+
MoreExecutors.directExecutor());
20842076

20852077
// Wraps all of the accumulated protos.
20862078
return ApiFutures.transform(
@@ -2099,33 +2091,25 @@ public List<String> apply(List<com.google.bigtable.admin.v2.SchemaBundle> protos
20992091
}
21002092

21012093
/**
2102-
* Deletes an schema bundle with the specified schema bundle ID in the specified
2103-
* table. Note
2104-
* that the deletion is prohibited if the schema bundle has deletion_protection
2105-
* field set to
2106-
* true.
2094+
* Deletes an schema bundle with the specified schema bundle ID in the specified table. Note that
2095+
* the deletion is prohibited if the schema bundle has deletion_protection field set to true.
21072096
*
2108-
* <p>
2109-
* Sample code:
2097+
* <p>Sample code:
21102098
*
21112099
* <pre>{@code
21122100
* client.deleteSchemaBundle("my-table", "my-schema-bundle");
21132101
* }</pre>
21142102
*/
21152103
public void deleteSchemaBundle(String tableId, String schemaBundleId) {
2116-
ApiExceptions.callAndTranslateApiException(
2117-
deleteSchemaBundleAsync(tableId, schemaBundleId));
2104+
ApiExceptions.callAndTranslateApiException(deleteSchemaBundleAsync(tableId, schemaBundleId));
21182105
}
21192106

21202107
/**
2121-
* Asynchronously deletes an schema bundle with the specified schema bundle ID
2122-
* in the
2123-
* specified table. Note that the deletion is prohibited if the schema bundle
2124-
* has
2125-
* deletion_protection field set to true.
2108+
* Asynchronously deletes an schema bundle with the specified schema bundle ID in the specified
2109+
* table. Note that the deletion is prohibited if the schema bundle has deletion_protection field
2110+
* set to true.
21262111
*
2127-
* <p>
2128-
* Sample code:
2112+
* <p>Sample code:
21292113
*
21302114
* <pre>{@code
21312115
* ApiFuture<void> future = client.deleteSchemaBundleAsync("my-table", "my-schema-bundle");
@@ -2146,10 +2130,11 @@ public void deleteSchemaBundle(String tableId, String schemaBundleId) {
21462130
* }</pre>
21472131
*/
21482132
public ApiFuture<Void> deleteSchemaBundleAsync(String tableId, String schemaBundleId) {
2149-
DeleteSchemaBundleRequest request = DeleteSchemaBundleRequest.newBuilder()
2150-
.setName(
2151-
NameUtil.formatSchemaBundleName(projectId, instanceId, tableId, schemaBundleId))
2152-
.build();
2133+
DeleteSchemaBundleRequest request =
2134+
DeleteSchemaBundleRequest.newBuilder()
2135+
.setName(
2136+
NameUtil.formatSchemaBundleName(projectId, instanceId, tableId, schemaBundleId))
2137+
.build();
21532138

21542139
return transformToVoid(this.stub.deleteSchemaBundleCallable().futureCall(request));
21552140
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/internal/NameUtil.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class NameUtil {
3838
private static final Pattern AUTHORIZED_VIEW_PATTERN =
3939
Pattern.compile("projects/([^/]+)/instances/([^/]+)/tables/([^/]+)/authorizedViews/([^/]+)");
4040

41-
private static final Pattern SCHEMA_BUNDLE_PATTERN = Pattern
42-
.compile("projects/([^/]+)/instances/([^/]+)/tables/([^/]+)/schemaBundles/([^/]+)");
41+
private static final Pattern SCHEMA_BUNDLE_PATTERN =
42+
Pattern.compile("projects/([^/]+)/instances/([^/]+)/tables/([^/]+)/schemaBundles/([^/]+)");
4343

4444
public static String formatProjectName(String projectId) {
4545
return "projects/" + projectId;
@@ -77,10 +77,10 @@ public static String formatAuthorizedViewName(
7777
return formatTableName(projectId, instanceId, tableId) + "/authorizedViews/" + viewId;
7878
}
7979

80-
public static String formatSchemaBundleName(
81-
String projectId, String instanceId, String tableId, String bundleId) {
82-
return formatTableName(projectId, instanceId, tableId) + "/schemaBundles/" + bundleId;
83-
}
80+
public static String formatSchemaBundleName(
81+
String projectId, String instanceId, String tableId, String bundleId) {
82+
return formatTableName(projectId, instanceId, tableId) + "/schemaBundles/" + bundleId;
83+
}
8484

8585
public static String extractTableIdFromTableName(String fullTableName) {
8686
Matcher matcher = TABLE_PATTERN.matcher(fullTableName);
@@ -107,8 +107,7 @@ public static String extractAuthorizedViewIdFromAuthorizedViewName(
107107
return matcher.group(4);
108108
}
109109

110-
public static String extractSchemaBundleIdFromSchemaBundleName(
111-
String fullSchemaBundleName) {
110+
public static String extractSchemaBundleIdFromSchemaBundleName(String fullSchemaBundleName) {
112111
Matcher matcher = SCHEMA_BUNDLE_PATTERN.matcher(fullSchemaBundleName);
113112
if (!matcher.matches()) {
114113
throw new IllegalArgumentException("Invalid schema bundle name: " + fullSchemaBundleName);

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateSchemaBundleRequest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import javax.annotation.Nonnull;
2424

2525
/**
26-
* Parameters for creating a new Cloud Bigtable {@link SchemaBundle}, which represents subsets of
27-
* a particular table.
26+
* Parameters for creating a new Cloud Bigtable {@link SchemaBundle}, which represents subsets of a
27+
* particular table.
2828
*
2929
* <p>Sample code:
3030
*
@@ -59,8 +59,7 @@ private CreateSchemaBundleRequest(@Nonnull String tableId, @Nonnull String schem
5959
*
6060
* @see SchemaBundleType for details.
6161
*/
62-
public CreateSchemaBundleRequest setProtoSchema(
63-
@Nonnull String protoFile) {
62+
public CreateSchemaBundleRequest setProtoSchema(@Nonnull String protoFile) {
6463
Preconditions.checkNotNull(protoFile, "protoSchema must be set");
6564

6665
return this;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/SchemaBundle.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717
package com.google.cloud.bigtable.admin.v2.models;
1818

1919
import com.google.api.core.InternalApi;
20-
import com.google.api.core.InternalExtensionOnly;
2120
import com.google.bigtable.admin.v2.SchemaBundleName;
2221
import com.google.common.base.Objects;
2322
import com.google.common.base.Preconditions;
2423
import javax.annotation.Nonnull;
2524

2625
/**
27-
* A class that wraps the {@link com.google.bigtable.admin.v2.SchemaBundle} protocol buffer
28-
* object.
26+
* A class that wraps the {@link com.google.bigtable.admin.v2.SchemaBundle} protocol buffer object.
2927
*
3028
* <p>An AuthorizedView represents subsets of a particular table based on rules. The access to each
3129
* AuthorizedView can be configured separately from the Table.
@@ -43,8 +41,7 @@ public final class SchemaBundle {
4341
* to be used by applications.
4442
*/
4543
@InternalApi
46-
public static SchemaBundle fromProto(
47-
@Nonnull com.google.bigtable.admin.v2.SchemaBundle proto) {
44+
public static SchemaBundle fromProto(@Nonnull com.google.bigtable.admin.v2.SchemaBundle proto) {
4845
return new SchemaBundle(proto);
4946
}
5047

@@ -58,7 +55,7 @@ private SchemaBundle(@Nonnull com.google.bigtable.admin.v2.SchemaBundle proto) {
5855

5956
/** Gets the schema bundle's id. */
6057
public String getId() {
61-
// Constructor ensures that name is not null.
58+
// Constructor ensures that name is not null.
6259
SchemaBundleName fullName = SchemaBundleName.parse(proto.getName());
6360

6461
//noinspection ConstantConditions
@@ -76,11 +73,10 @@ public String getTableId() {
7673

7774
/** Gets the proto schema of this schema bundle. */
7875
public com.google.protobuf.ByteString getProtoSchema() {
79-
if (proto.hasProtoSchema()){
80-
return proto.getProtoSchema().getProtoDescriptors();
76+
if (proto.hasProtoSchema()) {
77+
return proto.getProtoSchema().getProtoDescriptors();
8178
}
8279
throw new IllegalStateException("This SchemaBundle doesn't have a valid type specified");
83-
8480
}
8581

8682
/**

0 commit comments

Comments
 (0)