use of com.google.api.codegen.config.InterfaceConfig 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.config.InterfaceConfig 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;
}
}
Aggregations