use of com.google.api.codegen.transformer.ImportTypeTable in project toolkit by googleapis.
the class JavaSurfaceTransformer method addSettingsImports.
private void addSettingsImports(InterfaceContext context) {
ImportTypeTable typeTable = context.getImportTypeTable();
typeTable.saveNicknameFor("com.google.api.core.ApiFunction");
typeTable.saveNicknameFor("com.google.api.core.BetaApi");
typeTable.saveNicknameFor("com.google.api.gax.core.CredentialsProvider");
typeTable.saveNicknameFor("com.google.api.gax.core.ExecutorProvider");
typeTable.saveNicknameFor("com.google.api.gax.core.GaxProperties");
typeTable.saveNicknameFor("com.google.api.gax.core.GoogleCredentialsProvider");
typeTable.saveNicknameFor("com.google.api.gax.core.InstantiatingExecutorProvider");
typeTable.saveNicknameFor("com.google.api.gax.retrying.RetrySettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ApiClientHeaderProvider");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ClientContext");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ClientSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.StubSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.HeaderProvider");
typeTable.saveNicknameFor("com.google.api.gax.rpc.StatusCode");
typeTable.saveNicknameFor("com.google.api.gax.rpc.TransportChannelProvider");
typeTable.saveNicknameFor("com.google.api.gax.rpc.UnaryCallSettings");
typeTable.saveNicknameFor("com.google.auth.Credentials");
typeTable.saveNicknameFor("com.google.common.collect.ImmutableList");
typeTable.saveNicknameFor("com.google.common.collect.ImmutableMap");
typeTable.saveNicknameFor("com.google.common.collect.ImmutableSet");
typeTable.saveNicknameFor("com.google.common.collect.Lists");
typeTable.saveNicknameFor("com.google.common.collect.Sets");
typeTable.saveNicknameFor("java.io.IOException");
typeTable.saveNicknameFor("java.util.List");
typeTable.saveNicknameFor("java.util.concurrent.ScheduledExecutorService");
typeTable.saveNicknameFor("javax.annotation.Generated");
typeTable.saveNicknameFor("org.threeten.bp.Duration");
InterfaceConfig interfaceConfig = context.getInterfaceConfig();
if (interfaceConfig.hasPageStreamingMethods()) {
typeTable.saveNicknameFor("com.google.api.core.ApiFuture");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ApiCallContext");
typeTable.saveNicknameFor("com.google.api.gax.rpc.PageContext");
typeTable.saveNicknameFor("com.google.api.gax.rpc.PagedCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.PagedListDescriptor");
typeTable.saveNicknameFor("com.google.api.gax.rpc.PagedListResponseFactory");
typeTable.saveNicknameFor("com.google.api.gax.rpc.UnaryCallable");
}
if (interfaceConfig.hasBatchingMethods()) {
typeTable.saveNicknameFor("com.google.api.gax.batching.BatchingSettings");
typeTable.saveNicknameFor("com.google.api.gax.batching.FlowController");
typeTable.saveNicknameFor("com.google.api.gax.batching.FlowController.LimitExceededBehavior");
typeTable.saveNicknameFor("com.google.api.gax.batching.FlowControlSettings");
typeTable.saveNicknameFor("com.google.api.gax.batching.PartitionKey");
typeTable.saveNicknameFor("com.google.api.gax.batching.RequestBuilder");
typeTable.saveNicknameFor("com.google.api.gax.rpc.BatchedRequestIssuer");
typeTable.saveNicknameFor("com.google.api.gax.rpc.BatchingCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.BatchingDescriptor");
typeTable.saveNicknameFor("java.util.ArrayList");
typeTable.saveNicknameFor("java.util.Collection");
}
if (interfaceConfig.hasGrpcStreamingMethods(GrpcStreamingType.ServerStreaming)) {
typeTable.saveNicknameFor("com.google.api.gax.rpc.ServerStreamingCallSettings");
}
if (interfaceConfig.hasGrpcStreamingMethods(GrpcStreamingType.ClientStreaming) || interfaceConfig.hasGrpcStreamingMethods(GrpcStreamingType.BidiStreaming)) {
typeTable.saveNicknameFor("com.google.api.gax.rpc.StreamingCallSettings");
}
if (interfaceConfig.hasLongRunningOperations()) {
typeTable.saveNicknameFor("com.google.api.gax.longrunning.OperationSnapshot");
typeTable.saveNicknameFor("com.google.api.gax.rpc.OperationCallSettings");
typeTable.saveNicknameFor("com.google.longrunning.Operation");
typeTable.saveNicknameFor("com.google.api.gax.longrunning.OperationTimedPollAlgorithm");
}
switch(context.getProductConfig().getTransportProtocol()) {
case GRPC:
typeTable.saveNicknameFor("com.google.api.gax.grpc.GrpcTransportChannel");
typeTable.saveNicknameFor("com.google.api.gax.grpc.InstantiatingGrpcChannelProvider");
if (interfaceConfig.hasLongRunningOperations()) {
typeTable.saveNicknameFor("com.google.api.gax.grpc.ProtoOperationTransformers");
}
typeTable.saveNicknameFor("com.google.api.gax.grpc.GaxGrpcProperties");
break;
case HTTP:
typeTable.saveNicknameFor("com.google.api.gax.httpjson.HttpJsonTransportChannel");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.GaxHttpJsonProperties");
typeTable.saveNicknameFor("java.lang.Void");
break;
}
}
use of com.google.api.codegen.transformer.ImportTypeTable in project toolkit by googleapis.
the class JavaSurfaceTransformer method getAndSaveNicknameForStubType.
private String getAndSaveNicknameForStubType(InterfaceContext context, String nickname) {
SurfaceNamer namer = context.getNamer();
ImportTypeTable typeTable = context.getImportTypeTable();
String fullyQualifiedTypeName = namer.getStubPackageName() + "." + nickname;
return typeTable.getAndSaveNicknameFor(fullyQualifiedTypeName);
}
use of com.google.api.codegen.transformer.ImportTypeTable in project toolkit by googleapis.
the class JavaSurfaceTransformer method addStubInterfaceImports.
private void addStubInterfaceImports(InterfaceContext context) {
ImportTypeTable typeTable = context.getImportTypeTable();
typeTable.saveNicknameFor("com.google.api.core.BetaApi");
typeTable.saveNicknameFor("com.google.api.gax.core.BackgroundResource");
typeTable.saveNicknameFor("com.google.api.gax.rpc.UnaryCallable");
typeTable.saveNicknameFor("javax.annotation.Generated");
typeTable.saveNicknameFor("java.lang.Void");
InterfaceConfig interfaceConfig = context.getInterfaceConfig();
if (interfaceConfig.hasLongRunningOperations()) {
typeTable.saveNicknameFor("com.google.longrunning.Operation");
typeTable.saveNicknameFor("com.google.longrunning.stub.OperationsStub");
}
}
use of com.google.api.codegen.transformer.ImportTypeTable in project toolkit by googleapis.
the class JavaSurfaceTransformer method addRpcStubImports.
private void addRpcStubImports(InterfaceContext context) {
ImportTypeTable typeTable = context.getImportTypeTable();
typeTable.saveNicknameFor("com.google.api.core.BetaApi");
typeTable.saveNicknameFor("com.google.api.gax.core.BackgroundResource");
typeTable.saveNicknameFor("com.google.api.gax.core.BackgroundResourceAggregation");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ClientContext");
typeTable.saveNicknameFor("com.google.api.gax.rpc.UnaryCallable");
typeTable.saveNicknameFor("java.io.IOException");
typeTable.saveNicknameFor("java.util.ArrayList");
typeTable.saveNicknameFor("java.util.List");
typeTable.saveNicknameFor("java.util.Map");
typeTable.saveNicknameFor("java.util.concurrent.TimeUnit");
typeTable.saveNicknameFor("javax.annotation.Generated");
typeTable.saveNicknameFor("com.google.api.gax.rpc.RequestParamsExtractor");
typeTable.saveNicknameFor("com.google.common.collect.ImmutableMap");
InterfaceConfig interfaceConfig = context.getInterfaceConfig();
if (interfaceConfig.hasGrpcStreamingMethods(GrpcStreamingConfig.GrpcStreamingType.BidiStreaming)) {
typeTable.saveNicknameFor("com.google.api.gax.rpc.BidiStreamingCallable");
}
if (interfaceConfig.hasGrpcStreamingMethods(GrpcStreamingConfig.GrpcStreamingType.ServerStreaming)) {
typeTable.saveNicknameFor("com.google.api.gax.rpc.ServerStreamingCallable");
}
if (interfaceConfig.hasGrpcStreamingMethods(GrpcStreamingConfig.GrpcStreamingType.ClientStreaming)) {
typeTable.saveNicknameFor("com.google.api.gax.rpc.ClientStreamingCallable");
}
if (interfaceConfig.hasLongRunningOperations()) {
typeTable.saveNicknameFor("com.google.api.gax.longrunning.OperationSnapshot");
}
switch(context.getProductConfig().getTransportProtocol()) {
case GRPC:
typeTable.saveNicknameFor("com.google.api.gax.grpc.GrpcStubCallableFactory");
typeTable.saveNicknameFor("com.google.api.gax.grpc.GrpcCallableFactory");
typeTable.saveNicknameFor("com.google.api.gax.grpc.GrpcCallSettings");
typeTable.saveNicknameFor("io.grpc.MethodDescriptor");
typeTable.saveNicknameFor("io.grpc.protobuf.ProtoUtils");
if (interfaceConfig.hasLongRunningOperations()) {
typeTable.saveNicknameFor("com.google.longrunning.Operation");
typeTable.saveNicknameFor("com.google.longrunning.stub.GrpcOperationsStub");
}
break;
case HTTP:
typeTable.saveNicknameFor("com.google.api.client.http.HttpMethods");
typeTable.saveNicknameFor("com.google.api.core.InternalApi");
typeTable.saveNicknameFor("com.google.api.pathtemplate.PathTemplate");
if (context.getProductConfig().isDiscogapic()) {
typeTable.saveNicknameFor("com.google.api.gax.httpjson.ApiMessageHttpRequestFormatter");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.ApiMessageHttpResponseParser");
} else {
typeTable.saveNicknameFor("com.google.api.gax.httpjson.FieldsExtractor");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.ProtoRestSerializer");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.ProtoMessageRequestFormatter");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.ProtoMessageResponseParser");
typeTable.saveNicknameFor("java.util.HashMap");
}
typeTable.saveNicknameFor("com.google.api.gax.httpjson.ApiMethodDescriptor");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.HttpJsonCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.HttpJsonStubCallableFactory");
typeTable.saveNicknameFor("com.google.common.collect.Sets");
typeTable.saveNicknameFor("java.lang.Void");
break;
}
}
use of com.google.api.codegen.transformer.ImportTypeTable in project toolkit by googleapis.
the class JavaSurfaceTransformer method addCallableFactoryImports.
private void addCallableFactoryImports(InterfaceContext context) {
ImportTypeTable typeTable = context.getImportTypeTable();
typeTable.saveNicknameFor("com.google.api.gax.rpc.OperationCallable");
typeTable.saveNicknameFor("com.google.api.gax.rpc.OperationCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.BidiStreamingCallable");
typeTable.saveNicknameFor("com.google.api.gax.rpc.StreamingCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ServerStreamingCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ServerStreamingCallable");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ClientStreamingCallable");
typeTable.saveNicknameFor("com.google.api.gax.rpc.ClientContext");
typeTable.saveNicknameFor("com.google.api.gax.rpc.UnaryCallable");
typeTable.saveNicknameFor("com.google.api.gax.rpc.UnaryCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.PagedCallSettings");
typeTable.saveNicknameFor("com.google.api.gax.rpc.BatchingCallSettings");
switch(context.getProductConfig().getTransportProtocol()) {
case GRPC:
typeTable.saveNicknameFor("com.google.api.gax.grpc.GrpcCallableFactory");
typeTable.saveNicknameFor("com.google.api.gax.grpc.GrpcStubCallableFactory");
typeTable.saveNicknameFor("com.google.longrunning.Operation");
typeTable.saveNicknameFor("com.google.longrunning.stub.OperationsStub");
break;
case HTTP:
typeTable.saveNicknameFor("com.google.api.gax.httpjson.HttpJsonCallableFactory");
typeTable.saveNicknameFor("com.google.api.gax.httpjson.HttpJsonStubCallableFactory");
typeTable.saveNicknameFor("javax.annotation.Nullable");
break;
}
}
Aggregations