use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class MethodMerger method generateMethodsNode.
public void generateMethodsNode(ConfigNode parentNode, InterfaceModel apiInterface, Map<String, String> collectionNameMap) {
ConfigNode prevNode = NodeFinder.getLastChild(parentNode);
FieldConfigNode methodsNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "methods").setComment(new DefaultComment(METHODS_COMMENT));
prevNode.insertNext(methodsNode);
generateMethodsValueNode(methodsNode, apiInterface, collectionNameMap);
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class PageStreamingMerger method generatePageStreamingResponseNode.
private ConfigNode generatePageStreamingResponseNode(ConfigNode prevNode, MethodModel method) {
ConfigNode responseNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "response");
ConfigNode responseValueNode = pageStreamingTransformer.generateResponseValueNode(responseNode, method, helper);
if (!responseValueNode.isPresent()) {
return null;
}
prevNode.insertNext(responseNode);
return responseNode;
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class RetryMerger method generateRetryCodeDefNode.
private ConfigNode generateRetryCodeDefNode(int startLine, String name, List<String> codes) {
ConfigNode retryCodeDefNode = new ListItemConfigNode(startLine);
ConfigNode nameNode = FieldConfigNode.createStringPair(startLine, "name", name);
retryCodeDefNode.setChild(nameNode);
ConfigNode retryCodesNode = new FieldConfigNode(NodeFinder.getNextLine(nameNode), "retry_codes");
nameNode.insertNext(retryCodesNode);
ListTransformer.generateStringList(codes, retryCodesNode);
return retryCodeDefNode;
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class ListTransformerTest method testGenerateStringList.
@Test
public void testGenerateStringList() throws Exception {
List<String> elements = Arrays.asList("1", "2");
ConfigNode parent = new FieldConfigNode(0, "parent");
ConfigNode listNode = ListTransformer.generateStringList(elements, parent);
int index = 0;
for (ConfigNode node : NodeFinder.getChildren(parent)) {
Truth.assertThat(node.getChild().getText()).isEqualTo(elements.get(index++));
}
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class ListTransformerTest method testGenerateList.
@Test
public void testGenerateList() throws Exception {
List<Integer> elements = Arrays.asList(1, 2);
ConfigNode parent = new FieldConfigNode(0, "parent");
ConfigNode listNode = ListTransformer.generateList(elements, parent, (startLine, element) -> new ListItemConfigNode(startLine).setChild(new ScalarConfigNode(startLine, String.valueOf(element))));
int index = 0;
for (ConfigNode node : NodeFinder.getChildren(parent)) {
Truth.assertThat(node.getChild().getText()).isEqualTo(String.valueOf(elements.get(index++)));
}
}
Aggregations