use of com.google.api.codegen.viewmodel.ParseResourceFunctionView in project toolkit by googleapis.
the class PathTemplateTransformer method generateParseResourceFunctions.
public List<ParseResourceFunctionView> generateParseResourceFunctions(InterfaceContext context) {
List<ParseResourceFunctionView> functions = new ArrayList<>();
if (!context.getFeatureConfig().enableStringFormatFunctions()) {
return functions;
}
SurfaceNamer namer = context.getNamer();
InterfaceConfig interfaceConfig = context.getInterfaceConfig();
for (SingleResourceNameConfig resourceNameConfig : getSingleResourceNameConfigsUsedByInterface(context)) {
for (String var : resourceNameConfig.getNameTemplate().vars()) {
ParseResourceFunctionView.Builder function = ParseResourceFunctionView.newBuilder().entityName(resourceNameConfig.getEntityName()).name(namer.getParseFunctionName(var, resourceNameConfig)).pathTemplateName(namer.getPathTemplateName(interfaceConfig, resourceNameConfig)).pathTemplateGetterName(namer.getPathTemplateNameGetter(interfaceConfig, resourceNameConfig)).entityNameParamName(namer.getEntityNameParamName(resourceNameConfig)).outputResourceId(var);
functions.add(function.build());
}
}
return functions;
}
Aggregations