@Override public String getStaticLangReturnTypeName(MethodContext methodContext) { return methodContext .getMethodModel() .getOutputTypeName(methodContext.getTypeTable()) .getFullName(); }
@Override public String getDynamicLangReturnTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); if (method.isOutputTypeEmpty()) { return ""; } return method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); }
@Override public String getGenericAwareResponseTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); if (method.isOutputTypeEmpty()) { return "Void"; } else { return method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); } }
@Override public String getStaticLangReturnTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); if (method.isOutputTypeEmpty()) { return "void"; } return method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); }
@Override public String getStaticLangAsyncReturnTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); if (method.isOutputTypeEmpty()) { return "System.Threading.Tasks.Task"; } return "System.Threading.Tasks.Task<" + method.getOutputTypeName(methodContext.getTypeTable()).getFullName() + ">"; }
@Override public String getStaticLangReturnTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); if (method.isOutputTypeEmpty()) { return "void"; } return method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); }
@Override public List<String> getReturnDocLines( TransformationContext context, MethodContext methodContext, Synchronicity synchronicity) { MethodModel method = methodContext.getMethodModel(); MethodConfig methodConfig = methodContext.getMethodConfig(); if (method.getResponseStreaming()) { String classInfo = method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); return ImmutableList.of("An enumerable of " + classInfo + " instances.", ""); } if (methodConfig.isPageStreaming()) { String resourceTypeName = getTypeFormatter() .getFullNameForElementType(methodConfig.getPageStreaming().getResourcesField()); return ImmutableList.of( "An enumerable of " + resourceTypeName + " instances.", "See Google::Gax::PagedEnumerable documentation for other", "operations such as per-page iteration or access to the response", "object."); } return ImmutableList.of(); }
@Override public String getDynamicLangReturnTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); MethodConfig methodConfig = methodContext.getMethodConfig(); if (method.isOutputTypeEmpty()) { return ""; } String classInfo = method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); if (method.getResponseStreaming()) { return "Enumerable<" + classInfo + ">"; } if (methodConfig.isPageStreaming()) { String resourceTypeName = getModelTypeFormatter() .getFullNameForElementType(methodConfig.getPageStreaming().getResourcesField()); return "Google::Gax::PagedEnumerable<" + resourceTypeName + ">"; } if (methodConfig.isLongRunningOperation()) { return "Google::Gax::Operation"; } return classInfo; }
@Override public String getDynamicLangReturnTypeName(MethodContext methodContext) { MethodModel method = methodContext.getMethodModel(); MethodConfig methodConfig = methodContext.getMethodConfig(); if (method.isOutputTypeEmpty()) { return ""; } if (methodConfig.isPageStreaming()) { return "\\Google\\ApiCore\\PagedListResponse"; } if (methodConfig.isLongRunningOperation()) { return "\\Google\\ApiCore\\OperationResponse"; } switch (methodConfig.getGrpcStreamingType()) { case NonStreaming: return method.getOutputTypeName(methodContext.getTypeTable()).getFullName(); case BidiStreaming: return "\\Google\\ApiCore\\BidiStream"; case ClientStreaming: return "\\Google\\ApiCore\\ClientStream"; case ServerStreaming: return "\\Google\\ApiCore\\ServerStream"; default: return getNotImplementedString( "SurfaceNamer.getDynamicReturnTypeName grpcStreamingType:" + methodConfig.getGrpcStreamingType().toString()); } }
@Override public String getGrpcStreamingApiReturnTypeName( MethodContext methodContext, ImportTypeTable typeTable) { MethodModel method = methodContext.getMethodModel(); if (method.getRequestStreaming() && method.getResponseStreaming()) { // Bidirectional streaming return typeTable.getAndSaveNicknameForContainer( "Grpc.Core.AsyncDuplexStreamingCall", method.getAndSaveRequestTypeName(typeTable, methodContext.getNamer()), method.getAndSaveResponseTypeName(typeTable, methodContext.getNamer())); } else if (method.getRequestStreaming()) { // Client streaming return typeTable.getAndSaveNicknameForContainer( "Grpc.Core.AsyncClientStreamingCall", method.getAndSaveRequestTypeName(typeTable, methodContext.getNamer()), method.getAndSaveResponseTypeName(typeTable, methodContext.getNamer())); } else if (method.getResponseStreaming()) { // Server streaming return typeTable.getAndSaveNicknameForContainer( "Grpc.Core.AsyncServerStreamingCall", method.getOutputTypeName(methodContext.getTypeTable()).getFullName()); } else { throw new IllegalArgumentException("Expected some sort of streaming here."); } }
String callerResponseTypeName; String fullyQualifiedResponseTypeName = methodContext.getMethodModel().getOutputTypeName(typeTable).getFullName();