use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.
the class MethodMerger method generateFlatteningNode.
private ConfigNode generateFlatteningNode(ConfigNode prevNode, List<String> parameterList) {
ConfigNode flatteningNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "flattening").setComment(new FixmeComment("Configure which groups of fields should be flattened into method params."));
prevNode.insertNext(flatteningNode);
ConfigNode flatteningGroupsNode = new FieldConfigNode(NodeFinder.getNextLine(flatteningNode), "groups");
flatteningNode.setChild(flatteningGroupsNode);
ConfigNode groupNode = new ListItemConfigNode(NodeFinder.getNextLine(flatteningGroupsNode));
flatteningGroupsNode.setChild(groupNode);
ConfigNode parametersNode = new FieldConfigNode(groupNode.getStartLine(), "parameters");
groupNode.setChild(parametersNode);
ListTransformer.generateStringList(parameterList, parametersNode);
return flatteningNode;
}
use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.
the class MethodMerger method generateMethodNode.
private ListItemConfigNode generateMethodNode(int startLine, MethodModel method, Map<String, String> collectionNameMap) {
ListItemConfigNode methodNode = new ListItemConfigNode(startLine);
ConfigNode nameNode = FieldConfigNode.createStringPair(startLine, "name", method.getSimpleName());
methodNode.setChild(nameNode);
ConfigNode prevNode = generateField(nameNode, method);
prevNode = pageStreamingMerger.generatePageStreamingNode(prevNode, method);
prevNode = retryMerger.generateRetryNamesNode(prevNode, method);
prevNode = generateFieldNamePatterns(prevNode, method, collectionNameMap);
generateTimeout(prevNode, method);
return methodNode;
}
use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.
the class MethodMerger method generateFieldNamePatterns.
private ConfigNode generateFieldNamePatterns(ConfigNode prevNode, MethodModel method, final Map<String, String> nameMap) {
ConfigNode fieldNamePatternsNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "field_name_patterns");
ConfigNode fieldNamePatternsValueNode = ListTransformer.generateList(method.getResourcePatternNameMap(nameMap).entrySet(), fieldNamePatternsNode, (startLine, entry) -> FieldConfigNode.createStringPair(startLine, entry.getKey(), entry.getValue()));
if (!fieldNamePatternsValueNode.isPresent()) {
return prevNode;
}
prevNode.insertNext(fieldNamePatternsNode);
return fieldNamePatternsNode;
}
use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.
the class PageStreamingMerger method generatePageStreamingRequestNode.
private ConfigNode generatePageStreamingRequestNode(ConfigNode parentNode, MethodModel method) {
ConfigNode requestNode = new FieldConfigNode(NodeFinder.getNextLine(parentNode), "request");
parentNode.setChild(requestNode);
ConfigNode requestValueNode = generatePageStreamingRequestValueNode(requestNode, NodeFinder.getNextLine(requestNode), method);
return requestValueNode.isPresent() ? requestNode : null;
}
use of com.google.api.codegen.configgen.nodes.ConfigNode in project toolkit by googleapis.
the class PageStreamingMerger method generatePageStreamingNode.
public ConfigNode generatePageStreamingNode(ConfigNode prevNode, MethodModel method) {
ConfigNode pageStreamingNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "page_streaming");
ConfigNode requestNode = generatePageStreamingRequestNode(pageStreamingNode, method);
if (requestNode == null) {
return prevNode;
}
ConfigNode responseNode = generatePageStreamingResponseNode(requestNode, method);
if (responseNode == null) {
return prevNode;
}
prevNode.insertNext(pageStreamingNode);
return pageStreamingNode;
}
Aggregations