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

Commit 319553e

Browse files
authored
This library does not depend on GAX (#200)
1 parent 5799642 commit 319553e

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/main/java/com/google/api/core/AbstractApiService.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
import java.util.concurrent.TimeoutException;
3939

4040
/**
41-
* Base class for {@link ApiService}. Similar to Guava's {@code AbstractService} but redeclared to
41+
* Base class for {@link ApiService}. Similar to Guava's {@code AbstractService} but redeclared so
4242
* that Guava can be shaded.
4343
*/
4444
public abstract class AbstractApiService implements ApiService {
45-
private static final ImmutableMap<Service.State, ApiService.State> guavaToGaxState =
45+
private static final ImmutableMap<Service.State, ApiService.State> GUAVA_TO_API_SERVICE_STATE =
4646
ImmutableMap.<Service.State, ApiService.State>builder()
4747
.put(Service.State.FAILED, ApiService.State.FAILED)
4848
.put(Service.State.NEW, ApiService.State.NEW)
@@ -66,7 +66,7 @@ public void addListener(final ApiService.Listener listener, Executor executor) {
6666
new Service.Listener() {
6767
@Override
6868
public void failed(Service.State from, Throwable failure) {
69-
listener.failed(guavaToGaxState.get(from), failure);
69+
listener.failed(GUAVA_TO_API_SERVICE_STATE.get(from), failure);
7070
}
7171

7272
@Override
@@ -81,12 +81,12 @@ public void starting() {
8181

8282
@Override
8383
public void stopping(Service.State from) {
84-
listener.stopping(guavaToGaxState.get(from));
84+
listener.stopping(GUAVA_TO_API_SERVICE_STATE.get(from));
8585
}
8686

8787
@Override
8888
public void terminated(Service.State from) {
89-
listener.terminated(guavaToGaxState.get(from));
89+
listener.terminated(GUAVA_TO_API_SERVICE_STATE.get(from));
9090
}
9191
},
9292
executor);
@@ -122,7 +122,7 @@ public ApiService startAsync() {
122122
}
123123

124124
public State state() {
125-
return guavaToGaxState.get(impl.state());
125+
return GUAVA_TO_API_SERVICE_STATE.get(impl.state());
126126
}
127127

128128
public ApiService stopAsync() {

src/main/java/com/google/api/core/ApiFutureToListenableFuture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import java.util.concurrent.TimeoutException;
3838

3939
/**
40-
* INTERNAL USE ONLY. Adapter from GAX ApiFuture to Guava ListenableFuture.
40+
* INTERNAL USE ONLY. Adapter from ApiFuture to Guava ListenableFuture.
4141
*/
4242
@InternalApi
4343
public class ApiFutureToListenableFuture<V> implements ListenableFuture<V> {

src/main/java/com/google/api/core/ApiFutures.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static <V, X extends Throwable> ApiFuture<V> catching(
9999
Futures.catching(
100100
listenableFutureForApiFuture(input),
101101
exceptionType,
102-
new GaxFunctionToGuavaFunction<X, V>(callback),
102+
new ApiFunctionToGuavaFunction<X, V>(callback),
103103
executor);
104104
return new ListenableFutureToApiFuture<V>(catchingFuture);
105105
}
@@ -156,7 +156,7 @@ public static <V, X> ApiFuture<X> transform(
156156
return new ListenableFutureToApiFuture<>(
157157
Futures.transform(
158158
listenableFutureForApiFuture(input),
159-
new GaxFunctionToGuavaFunction<V, X>(function),
159+
new ApiFunctionToGuavaFunction<V, X>(function),
160160
executor));
161161
}
162162

@@ -226,11 +226,11 @@ private static <V> ListenableFuture<V> listenableFutureForApiFuture(ApiFuture<V>
226226
return listenableFuture;
227227
}
228228

229-
private static class GaxFunctionToGuavaFunction<X, V>
229+
private static class ApiFunctionToGuavaFunction<X, V>
230230
implements com.google.common.base.Function<X, V> {
231231
private ApiFunction<? super X, ? extends V> f;
232232

233-
public GaxFunctionToGuavaFunction(ApiFunction<? super X, ? extends V> f) {
233+
public ApiFunctionToGuavaFunction(ApiFunction<? super X, ? extends V> f) {
234234
this.f = f;
235235
}
236236

src/main/java/com/google/api/core/ListenableFutureToApiFuture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import com.google.common.util.concurrent.ListenableFuture;
3535

3636
/**
37-
* INTERNAL USE ONLY. Adapter from Guava ListenableFuture to GAX ApiFuture.
37+
* INTERNAL USE ONLY. Adapter from Guava ListenableFuture to ApiFuture.
3838
*/
3939
@InternalApi
4040
public class ListenableFutureToApiFuture<V> extends SimpleForwardingListenableFuture<V>

0 commit comments

Comments
 (0)