Search in sources :

Example 1 with PathTemplateGetterFunctionView

use of com.google.api.codegen.viewmodel.PathTemplateGetterFunctionView in project toolkit by googleapis.

the class PathTemplateTransformer method generatePathTemplateGetterFunctions.

public List<PathTemplateGetterFunctionView> generatePathTemplateGetterFunctions(GapicInterfaceContext context) {
    List<PathTemplateGetterFunctionView> functions = new ArrayList<>();
    SurfaceNamer namer = context.getNamer();
    InterfaceConfig interfaceConfig = context.getInterfaceConfig();
    for (SingleResourceNameConfig resourceNameConfig : getSingleResourceNameConfigsUsedByInterface(context)) {
        PathTemplateGetterFunctionView.Builder function = PathTemplateGetterFunctionView.newBuilder().name(namer.getPathTemplateNameGetter(interfaceConfig, resourceNameConfig)).resourceName(namer.getPathTemplateResourcePhraseName(resourceNameConfig)).entityName(namer.getEntityName(resourceNameConfig)).pathTemplateName(namer.getPathTemplateName(interfaceConfig, resourceNameConfig)).pattern(resourceNameConfig.getNamePattern());
        functions.add(function.build());
    }
    return functions;
}
Also used : PathTemplateGetterFunctionView(com.google.api.codegen.viewmodel.PathTemplateGetterFunctionView) InterfaceConfig(com.google.api.codegen.config.InterfaceConfig) ArrayList(java.util.ArrayList) SingleResourceNameConfig(com.google.api.codegen.config.SingleResourceNameConfig)

Aggregations

InterfaceConfig (com.google.api.codegen.config.InterfaceConfig)1 SingleResourceNameConfig (com.google.api.codegen.config.SingleResourceNameConfig)1 PathTemplateGetterFunctionView (com.google.api.codegen.viewmodel.PathTemplateGetterFunctionView)1 ArrayList (java.util.ArrayList)1