Search in sources :

Example 1 with PathTemplateView

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

the class PathTemplateTransformer method generatePathTemplates.

public List<PathTemplateView> generatePathTemplates(InterfaceContext context) {
    List<PathTemplateView> pathTemplates = new ArrayList<>();
    if (!context.getFeatureConfig().enableStringFormatFunctions()) {
        return pathTemplates;
    }
    for (SingleResourceNameConfig resourceNameConfig : getSingleResourceNameConfigsUsedByInterface(context)) {
        PathTemplateView.Builder pathTemplate = PathTemplateView.newBuilder();
        pathTemplate.name(context.getNamer().getPathTemplateName(context.getInterfaceConfig(), resourceNameConfig));
        pathTemplate.pattern(resourceNameConfig.getNamePattern());
        pathTemplates.add(pathTemplate.build());
    }
    return pathTemplates;
}
Also used : PathTemplateView(com.google.api.codegen.viewmodel.PathTemplateView) ArrayList(java.util.ArrayList) SingleResourceNameConfig(com.google.api.codegen.config.SingleResourceNameConfig)

Aggregations

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