Skip to content

Commit 32f244f

Browse files
authored
feat(bigtable): Remove deprecated Bytes from BigEndianBytesEncoding (#2309)
1 parent acaa3ff commit 32f244f

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ If you are using Maven without the BOM, add this to your dependencies:
5050
If you are using Gradle 5.x or later, add this to your dependencies:
5151

5252
```Groovy
53-
implementation platform('com.google.cloud:libraries-bom:26.43.0')
53+
implementation platform('com.google.cloud:libraries-bom:26.44.0')
5454
5555
implementation 'com.google.cloud:google-cloud-bigtable'
5656
```
5757
If you are using Gradle without BOM, add this to your dependencies:
5858

5959
```Groovy
60-
implementation 'com.google.cloud:google-cloud-bigtable:2.41.0'
60+
implementation 'com.google.cloud:google-cloud-bigtable:2.42.0'
6161
```
6262

6363
If you are using SBT, add this to your dependencies:
6464

6565
```Scala
66-
libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.41.0"
66+
libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.42.0"
6767
```
6868
<!-- {x-version-update-end} -->
6969

@@ -542,7 +542,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
542542
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigtable/java11.html
543543
[stability-image]: https://img.shields.io/badge/stability-stable-green
544544
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigtable.svg
545-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.41.0
545+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.42.0
546546
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
547547
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
548548
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

google-cloud-bigtable/clirr-ignored-differences.xml

+10
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,14 @@
249249
<className>com/google/cloud/bigtable/admin/v2/models/Type$Raw</className>
250250
<to>com/google/cloud/bigtable/admin/v2/models/Type</to>
251251
</difference>
252+
<difference>
253+
<differenceType>7004</differenceType>
254+
<className>com/google/cloud/bigtable/admin/v2/models/Type$Int64$Encoding$BigEndianBytes</className>
255+
<method>*</method>
256+
</difference>
257+
<difference>
258+
<differenceType>7002</differenceType>
259+
<className>com/google/cloud/bigtable/admin/v2/models/Type$Int64$Encoding$BigEndianBytes</className>
260+
<method>*</method>
261+
</difference>
252262
</differences>

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

+6-10
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static Bytes bytes(Bytes.Encoding encoding) {
7676
* Creates an Int64 type with a big-endian encoding. The bytes are then encoded in "raw" format.
7777
*/
7878
public static Int64 bigEndianInt64() {
79-
return Int64.create(Int64.Encoding.BigEndianBytes.create(Type.rawBytes()));
79+
return Int64.create(Int64.Encoding.BigEndianBytes.create());
8080
}
8181

8282
/** Creates an Int64 type with the specified encoding. */
@@ -200,29 +200,25 @@ public abstract static class Encoding {
200200
static Encoding fromProto(com.google.bigtable.admin.v2.Type.Int64.Encoding source) {
201201
switch (source.getEncodingCase()) {
202202
case BIG_ENDIAN_BYTES:
203-
return BigEndianBytes.create(
204-
Bytes.fromProto(source.getBigEndianBytes().getBytesType()));
203+
return BigEndianBytes.create();
205204
case ENCODING_NOT_SET:
206-
return BigEndianBytes.create(Type.rawBytes());
205+
return BigEndianBytes.create();
207206
}
208207
throw new UnsupportedOperationException();
209208
}
210209

211210
@AutoValue
212211
public abstract static class BigEndianBytes extends Encoding {
213212

214-
public static BigEndianBytes create(Bytes bytes) {
215-
return new AutoValue_Type_Int64_Encoding_BigEndianBytes(bytes);
213+
public static BigEndianBytes create() {
214+
return new AutoValue_Type_Int64_Encoding_BigEndianBytes();
216215
}
217216

218-
@Nonnull
219-
public abstract Bytes getBytes();
220-
221217
@Override
222218
public com.google.bigtable.admin.v2.Type.Int64.Encoding toProto() {
223219
com.google.bigtable.admin.v2.Type.Int64.Encoding.Builder builder =
224220
com.google.bigtable.admin.v2.Type.Int64.Encoding.newBuilder();
225-
builder.getBigEndianBytesBuilder().setBytesType(getBytes().toProto().getBytesType());
221+
builder.getBigEndianBytesBuilder();
226222
return builder.build();
227223
}
228224
}

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/TypeProtos.java

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public static com.google.bigtable.admin.v2.Type int64Type() {
3434
.setBigEndianBytes(
3535
com.google.bigtable.admin.v2.Type.Int64.Encoding.BigEndianBytes
3636
.newBuilder()
37-
.setBytesType(bytesType())
3837
.build())
3938
.build()))
4039
.build();

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/TypeTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void bigEndianInt64() {
5555

5656
@Test
5757
public void int64WithEncoding() {
58-
Type type = Type.int64(Int64.Encoding.BigEndianBytes.create(Type.rawBytes()));
58+
Type type = Type.int64(Int64.Encoding.BigEndianBytes.create());
5959
assertThat(type.toProto()).isEqualTo(TypeProtos.int64Type());
6060
}
6161

0 commit comments

Comments
 (0)