Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 6986422

Browse files
Switching most of() methods back to create() (#400)
1 parent 1f197e5 commit 6986422

68 files changed

Lines changed: 259 additions & 314 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public final class GrpcCallContext implements ApiCallContext {
5757
private final CallOptions callOptions;
5858

5959
/** Returns an empty instance with a null channel and default {@link CallOptions}. */
60-
public static GrpcCallContext of() {
60+
public static GrpcCallContext createDefault() {
6161
return new GrpcCallContext(null, CallOptions.DEFAULT);
6262
}
6363

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcCallSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static <RequestT, ResponseT> Builder<RequestT, ResponseT> newBuilder() {
5959
return new Builder<>();
6060
}
6161

62-
public static <RequestT, ResponseT> GrpcCallSettings<RequestT, ResponseT> of(
62+
public static <RequestT, ResponseT> GrpcCallSettings<RequestT, ResponseT> create(
6363
MethodDescriptor<RequestT, ResponseT> methodDescriptor) {
6464
return GrpcCallSettings.<RequestT, ResponseT>newBuilder()
6565
.setMethodDescriptor(methodDescriptor)

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcDirectCallable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class GrpcDirectCallable<RequestT, ResponseT> extends UnaryCallable<RequestT, Re
5656
public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext inputContext) {
5757
Preconditions.checkNotNull(request);
5858
Preconditions.checkNotNull(inputContext);
59-
GrpcCallContext context = GrpcCallContext.of().nullToSelf(inputContext);
59+
GrpcCallContext context = GrpcCallContext.createDefault().nullToSelf(inputContext);
6060

6161
return new ListenableFutureToApiFuture<>(
6262
ClientCalls.futureUnaryCall(

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcExceptionCallable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class GrpcExceptionCallable<RequestT, ResponseT> extends UnaryCallable<RequestT,
6363

6464
@Override
6565
public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext inputContext) {
66-
GrpcCallContext context = GrpcCallContext.of().nullToSelf(inputContext);
66+
GrpcCallContext context = GrpcCallContext.createDefault().nullToSelf(inputContext);
6767
ApiFuture<ResponseT> innerCallFuture = callable.futureCall(request, context);
6868
ExceptionTransformingFuture transformingFuture =
6969
new ExceptionTransformingFuture(innerCallFuture);

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcLongRunningClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public GrpcLongRunningClient(OperationsStub operationsStub) {
5555

5656
@Override
5757
public UnaryCallable<String, OperationSnapshot> getOperationCallable() {
58-
return TranslatingUnaryCallable.of(
58+
return TranslatingUnaryCallable.create(
5959
operationsStub.getOperationCallable(),
6060
new ApiFunction<String, GetOperationRequest>() {
6161
@Override
@@ -66,14 +66,14 @@ public GetOperationRequest apply(String request) {
6666
new ApiFunction<Operation, OperationSnapshot>() {
6767
@Override
6868
public OperationSnapshot apply(Operation operation) {
69-
return GrpcOperationSnapshot.of(operation);
69+
return GrpcOperationSnapshot.create(operation);
7070
}
7171
});
7272
}
7373

7474
@Override
7575
public UnaryCallable<String, Void> cancelOperationCallable() {
76-
return TranslatingUnaryCallable.of(
76+
return TranslatingUnaryCallable.create(
7777
operationsStub.cancelOperationCallable(),
7878
new ApiFunction<String, CancelOperationRequest>() {
7979
@Override
@@ -91,7 +91,7 @@ public Void apply(Empty empty) {
9191

9292
@Override
9393
public UnaryCallable<String, Void> deleteOperationCallable() {
94-
return TranslatingUnaryCallable.of(
94+
return TranslatingUnaryCallable.create(
9595
operationsStub.deleteOperationCallable(),
9696
new ApiFunction<String, DeleteOperationRequest>() {
9797
@Override
@@ -107,7 +107,7 @@ public Void apply(Empty empty) {
107107
});
108108
}
109109

110-
public static GrpcLongRunningClient of(OperationsStub operationsStub) {
110+
public static GrpcLongRunningClient create(OperationsStub operationsStub) {
111111
return new GrpcLongRunningClient(operationsStub);
112112
}
113113
}

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcOperationSnapshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public StatusCode getErrorCode() {
7272
return GrpcStatusCode.of(Status.fromCodeValue(operation.getError().getCode()).getCode());
7373
}
7474

75-
public static GrpcOperationSnapshot of(Operation operation) {
75+
public static GrpcOperationSnapshot create(Operation operation) {
7676
return new GrpcOperationSnapshot(operation);
7777
}
7878
}

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcServerStreamingRequestParamCallable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public Iterator<ResponseT> blockingServerStreamingCall(RequestT request, ApiCall
7070
}
7171

7272
private ApiCallContext contextWithParamsEncoder(RequestT request, ApiCallContext inputContext) {
73-
return GrpcCallContext.of()
73+
return GrpcCallContext.createDefault()
7474
.nullToSelf(inputContext)
7575
.withRequestParamsDynamicHeaderOption(paramsEncoder.encode(request));
7676
}

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcTransportChannel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public String getTransportName() {
5353

5454
@Override
5555
public GrpcCallContext getEmptyCallContext() {
56-
return GrpcCallContext.of();
56+
return GrpcCallContext.createDefault();
5757
}
5858

5959
/** The channel in use. */
@@ -97,7 +97,7 @@ public static Builder newBuilder() {
9797
return new AutoValue_GrpcTransportChannel.Builder();
9898
}
9999

100-
public static GrpcTransportChannel of(ManagedChannel channel) {
100+
public static GrpcTransportChannel create(ManagedChannel channel) {
101101
return newBuilder().setManagedChannel(channel).build();
102102
}
103103

gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcUnaryRequestParamCallable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class GrpcUnaryRequestParamCallable<RequestT, ResponseT>
5858
@Override
5959
public ApiFuture<ResponseT> futureCall(RequestT request, ApiCallContext inputContext) {
6060
GrpcCallContext newCallContext =
61-
GrpcCallContext.of()
61+
GrpcCallContext.createDefault()
6262
.nullToSelf(inputContext)
6363
.withRequestParamsDynamicHeaderOption(paramsEncoder.encode(request));
6464

gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public boolean needsExecutor() {
8585

8686
@Override
8787
public TransportChannelProvider withExecutor(ScheduledExecutorService executor) {
88-
return toBuilder().setExecutorProvider(FixedExecutorProvider.of(executor)).build();
88+
return toBuilder().setExecutorProvider(FixedExecutorProvider.create(executor)).build();
8989
}
9090

9191
@Override
@@ -95,7 +95,7 @@ public boolean needsHeaders() {
9595

9696
@Override
9797
public TransportChannelProvider withHeaders(Map<String, String> headers) {
98-
return toBuilder().setHeaderProvider(FixedHeaderProvider.of(headers)).build();
98+
return toBuilder().setHeaderProvider(FixedHeaderProvider.create(headers)).build();
9999
}
100100

101101
@Override

0 commit comments

Comments
 (0)