Search in sources :

Example 6 with ListItemConfigNode

use of com.google.api.codegen.configgen.nodes.ListItemConfigNode in project toolkit by googleapis.

the class CollectionMerger method generateCollectionNode.

private ConfigNode generateCollectionNode(int startLine, String namePattern, String entityName) {
    ConfigNode collectionNode = new ListItemConfigNode(startLine);
    ConfigNode namePatternNode = FieldConfigNode.createStringPair(collectionNode.getStartLine(), "name_pattern", namePattern);
    collectionNode.setChild(namePatternNode);
    ConfigNode entityNameNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(namePatternNode), "entity_name", entityName);
    namePatternNode.insertNext(entityNameNode);
    return collectionNode;
}
Also used : ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode)

Example 7 with ListItemConfigNode

use of com.google.api.codegen.configgen.nodes.ListItemConfigNode 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;
}
Also used : FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) FixmeComment(com.google.api.codegen.configgen.nodes.metadata.FixmeComment) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode)

Example 8 with ListItemConfigNode

use of com.google.api.codegen.configgen.nodes.ListItemConfigNode 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;
}
Also used : ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode)

Aggregations

ConfigNode (com.google.api.codegen.configgen.nodes.ConfigNode)8 FieldConfigNode (com.google.api.codegen.configgen.nodes.FieldConfigNode)8 ListItemConfigNode (com.google.api.codegen.configgen.nodes.ListItemConfigNode)8 ScalarConfigNode (com.google.api.codegen.configgen.nodes.ScalarConfigNode)2 NullConfigNode (com.google.api.codegen.configgen.nodes.NullConfigNode)1 DefaultComment (com.google.api.codegen.configgen.nodes.metadata.DefaultComment)1 FixmeComment (com.google.api.codegen.configgen.nodes.metadata.FixmeComment)1 Test (org.junit.Test)1 MappingNode (org.yaml.snakeyaml.nodes.MappingNode)1 Node (org.yaml.snakeyaml.nodes.Node)1 ScalarNode (org.yaml.snakeyaml.nodes.ScalarNode)1 SequenceNode (org.yaml.snakeyaml.nodes.SequenceNode)1