Skip to content

Commit 1535cc1

Browse files
Reducing visibility of some things, adding @internalapi
1 parent 5dae747 commit 1535cc1

24 files changed

Lines changed: 71 additions & 24 deletions

File tree

google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/BaseGrpcServiceException.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.cloud.grpc;
1818

1919
import com.google.api.client.http.HttpResponseException;
20+
import com.google.api.core.InternalApi;
2021
import com.google.api.gax.grpc.ApiException;
2122
import com.google.cloud.BaseServiceException;
2223
import com.google.common.base.MoreObjects;
@@ -30,12 +31,14 @@ public class BaseGrpcServiceException extends BaseServiceException {
3031

3132
private static final long serialVersionUID = -2685197215731335549L;
3233

33-
public BaseGrpcServiceException(String message, Throwable cause, int code, boolean retryable) {
34+
@InternalApi("This class should only be extended within google-cloud-java")
35+
protected BaseGrpcServiceException(String message, Throwable cause, int code, boolean retryable) {
3436
super(ExceptionData.newBuilder().setMessage(message).setCause(cause).setCode(code)
3537
.setRetryable(retryable).build());
3638
}
3739

38-
public BaseGrpcServiceException(IOException exception, boolean idempotent) {
40+
@InternalApi("This class should only be extended within google-cloud-java")
41+
protected BaseGrpcServiceException(IOException exception, boolean idempotent) {
3942
super(makeExceptionData(exception, idempotent));
4043
}
4144

google-cloud-core-http/src/main/java/com/google/cloud/http/BaseHttpServiceException.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.client.googleapis.json.GoogleJsonError;
2020
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
2121
import com.google.api.client.http.HttpResponseException;
22+
import com.google.api.core.InternalApi;
2223
import com.google.cloud.BaseServiceException;
2324
import com.google.common.base.MoreObjects;
2425
import java.io.IOException;
@@ -32,7 +33,8 @@ public class BaseHttpServiceException extends BaseServiceException {
3233
private static final long serialVersionUID = -5793034110344127954L;
3334
public static final int UNKNOWN_CODE = 0;
3435

35-
public BaseHttpServiceException(IOException exception, boolean idempotent,
36+
@InternalApi("This class should only be extended within google-cloud-java")
37+
protected BaseHttpServiceException(IOException exception, boolean idempotent,
3638
Set<BaseServiceException.Error> retryableErrors) {
3739
super(makeExceptionData(exception, idempotent, retryableErrors));
3840
}
@@ -80,7 +82,8 @@ private static ExceptionData makeExceptionData(IOException exception, boolean id
8082
.build();
8183
}
8284

83-
public BaseHttpServiceException(GoogleJsonError googleJsonError, boolean idempotent,
85+
@InternalApi("This class should only be extended within google-cloud-java")
86+
protected BaseHttpServiceException(GoogleJsonError googleJsonError, boolean idempotent,
8487
Set<BaseServiceException.Error> retryableErrors) {
8588
super(makeExceptionData(googleJsonError, idempotent, retryableErrors));
8689
}
@@ -108,12 +111,14 @@ private static ExceptionData makeExceptionData(GoogleJsonError googleJsonError,
108111
return exceptionData.build();
109112
}
110113

111-
public BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
114+
@InternalApi("This class should only be extended within google-cloud-java")
115+
protected BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
112116
Set<BaseServiceException.Error> retryableErrors) {
113117
this(code, message, reason, idempotent, retryableErrors, null);
114118
}
115119

116-
public BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
120+
@InternalApi("This class should only be extended within google-cloud-java")
121+
protected BaseHttpServiceException(int code, String message, String reason, boolean idempotent,
117122
Set<BaseServiceException.Error> retryableErrors, Throwable cause) {
118123
super(ExceptionData.newBuilder()
119124
.setMessage(message)

google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.api.client.http.HttpRequestInitializer;
2525
import com.google.api.client.http.HttpTransport;
2626
import com.google.api.client.http.javanet.NetHttpTransport;
27+
import com.google.api.core.InternalApi;
2728
import com.google.auth.Credentials;
2829
import com.google.auth.http.HttpCredentialsAdapter;
2930
import com.google.auth.http.HttpTransportFactory;
@@ -122,7 +123,7 @@ public Builder setReadTimeout(int readTimeout) {
122123
}
123124
}
124125

125-
protected HttpTransportOptions(Builder builder) {
126+
private HttpTransportOptions(Builder builder) {
126127
httpTransportFactory = firstNonNull(builder.httpTransportFactory,
127128
ServiceOptions.getFromServiceLoader(HttpTransportFactory.class,
128129
DefaultHttpTransportFactory.INSTANCE));

google-cloud-core/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
<dependency>
4949
<groupId>com.google.api</groupId>
5050
<artifactId>api-common</artifactId>
51-
<version>${api-common.version}</version>
5251
</dependency>
5352
<dependency>
5453
<groupId>com.google.api</groupId>

google-cloud-core/src/main/java/com/google/cloud/BaseService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud;
1818

19+
import com.google.api.core.InternalApi;
1920
import com.google.cloud.ExceptionHandler.Interceptor;
2021

2122
/**
@@ -51,6 +52,7 @@ public RetryResult beforeEval(Exception exception) {
5152

5253
private final OptionsT options;
5354

55+
@InternalApi("This class should only be extended within google-cloud-java")
5456
protected BaseService(OptionsT options) {
5557
this.options = options;
5658
}

google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ public static void translate(RetryHelper.RetryHelperException ex) {
253253
}
254254
}
255255

256-
public BaseServiceException(ExceptionData exceptionData) {
256+
@InternalApi("This class should only be extended within google-cloud-java")
257+
protected BaseServiceException(ExceptionData exceptionData) {
257258
super(exceptionData.getMessage(), exceptionData.getCause());
258259
this.code = exceptionData.getCode();
259260
this.reason = exceptionData.getReason();

google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud;
1818

19+
import com.google.api.core.InternalApi;
1920
import java.io.IOException;
2021
import java.io.Serializable;
2122
import java.nio.ByteBuffer;
@@ -107,6 +108,7 @@ public final void setChunkSize(int chunkSize) {
107108
this.chunkSize = Math.max(getMinChunkSize(), chunkSize);
108109
}
109110

111+
@InternalApi("This class should only be extended within google-cloud-java")
110112
protected BaseWriteChannel(ServiceOptionsT options, EntityT entity, String uploadId) {
111113
this.options = options;
112114
this.entity = entity;
@@ -209,6 +211,7 @@ protected abstract static class BaseState<
209211
protected final boolean isOpen;
210212
protected final int chunkSize;
211213

214+
@InternalApi("This class should only be extended within google-cloud-java")
212215
protected BaseState(Builder<ServiceOptionsT, EntityT> builder) {
213216
this.serviceOptions = builder.serviceOptions;
214217
this.entity = builder.entity;
@@ -238,6 +241,7 @@ public abstract static class Builder<
238241
private boolean isOpen;
239242
private int chunkSize;
240243

244+
@InternalApi("This class should only be extended within google-cloud-java")
241245
protected Builder(ServiceOptionsT options, EntityT entity, String uploadId) {
242246
this.serviceOptions = options;
243247
this.entity = entity;

google-cloud-core/src/main/java/com/google/cloud/BatchResult.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020
import static com.google.common.base.Preconditions.checkState;
2121

22+
import com.google.api.core.InternalApi;
2223
import java.util.LinkedList;
2324
import java.util.List;
2425

@@ -36,6 +37,10 @@ public abstract class BatchResult<T, E extends BaseServiceException> {
3637
private E error;
3738
private final List<Callback<T, E>> toBeNotified = new LinkedList<>();
3839

40+
@InternalApi("This class should only be extended within google-cloud-java")
41+
protected BatchResult() {
42+
}
43+
3944
/**
4045
* Returns {@code true} if the batch has been completed and the result is available; {@code false}
4146
* otherwise.

google-cloud-core/src/main/java/com/google/cloud/ByteArray.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,10 @@ public class ByteArray implements Iterable<Byte>, Serializable {
4040

4141
private final ByteString byteString;
4242

43-
protected ByteArray(ByteString byteString) {
43+
ByteArray(ByteString byteString) {
4444
this.byteString = byteString;
4545
}
4646

47-
protected ByteArray(ByteArray byteArray) {
48-
this.byteString = byteArray.getByteString();
49-
}
50-
5147
@Override
5248
public final Iterator<Byte> iterator() {
5349
return byteString.iterator();
@@ -117,11 +113,6 @@ public final InputStream asInputStream() {
117113
return byteString.newInput();
118114
}
119115

120-
121-
protected ByteString getByteString() {
122-
return byteString;
123-
}
124-
125116
/**
126117
* Copies the content of this {@code ByteArray} into an existing {@code ByteBuffer}.
127118
*

google-cloud-core/src/main/java/com/google/cloud/Date.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* Represents a Date without time, such as 2017-03-17. Date is timezone independent.
2929
*/
30-
@BetaApi
30+
@BetaApi("This is going to be replaced with LocalDate from threetenbp")
3131
public final class Date implements Comparable<Date>, Serializable {
3232

3333
// Date format "yyyy-mm-dd"

0 commit comments

Comments
 (0)