Search in sources :

Example 51 with MethodConfig

use of com.google.api.codegen.config.MethodConfig in project toolkit by googleapis.

the class RubySurfaceNamer method getDynamicLangReturnTypeName.

@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;
}
Also used : MethodConfig(com.google.api.codegen.config.MethodConfig) MethodModel(com.google.api.codegen.config.MethodModel)

Aggregations

MethodConfig (com.google.api.codegen.config.MethodConfig)51 MethodModel (com.google.api.codegen.config.MethodModel)29 ArrayList (java.util.ArrayList)20 ImmutableList (com.google.common.collect.ImmutableList)14 FieldModel (com.google.api.codegen.config.FieldModel)13 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)9 DiscoveryMethodModel (com.google.api.codegen.config.DiscoveryMethodModel)8 MethodContext (com.google.api.codegen.transformer.MethodContext)8 FieldConfig (com.google.api.codegen.config.FieldConfig)7 FlatteningConfig (com.google.api.codegen.config.FlatteningConfig)6 GapicMethodContext (com.google.api.codegen.transformer.GapicMethodContext)6 SimpleParamDocView (com.google.api.codegen.viewmodel.SimpleParamDocView)6 StaticLangApiMethodView (com.google.api.codegen.viewmodel.StaticLangApiMethodView)6 ParamDocView (com.google.api.codegen.viewmodel.ParamDocView)5 GapicMethodConfig (com.google.api.codegen.config.GapicMethodConfig)4 GapicInterfaceConfig (com.google.api.codegen.config.GapicInterfaceConfig)3 InterfaceConfig (com.google.api.codegen.config.InterfaceConfig)3 PageStreamingConfig (com.google.api.codegen.config.PageStreamingConfig)3 ParamWithSimpleDoc (com.google.api.codegen.transformer.ParamWithSimpleDoc)3 SymbolTable (com.google.api.codegen.util.SymbolTable)3