Search in sources :

Example 6 with DefaultComment

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

the class CollectionMerger method generateCollectionsNode.

public ConfigNode generateCollectionsNode(ConfigNode prevNode, Map<String, String> nameMap) {
    FieldConfigNode collectionsNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "collections").setComment(new DefaultComment(COLLECTIONS_COMMENT));
    prevNode.insertNext(collectionsNode);
    ListTransformer.generateList(nameMap.entrySet(), collectionsNode, (startLine, entry) -> generateCollectionNode(startLine, entry.getKey(), entry.getValue()));
    return collectionsNode;
}
Also used : FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) DefaultComment(com.google.api.codegen.configgen.nodes.metadata.DefaultComment)

Example 7 with DefaultComment

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

the class InterfaceMerger method mergeInterfaces.

public void mergeInterfaces(ApiModel model, ConfigNode configNode) {
    FieldConfigNode interfacesNode = MissingFieldTransformer.append("interfaces", configNode).generate();
    if (NodeFinder.hasContent(interfacesNode.getChild())) {
        return;
    }
    ConfigNode interfacesValueNode = ListTransformer.generateList(model.getInterfaces(), interfacesNode, this::generateInterfaceNode);
    interfacesNode.setChild(interfacesValueNode).setComment(new DefaultComment("A list of API interface configurations."));
}
Also used : FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ListItemConfigNode(com.google.api.codegen.configgen.nodes.ListItemConfigNode) FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) ConfigNode(com.google.api.codegen.configgen.nodes.ConfigNode) DefaultComment(com.google.api.codegen.configgen.nodes.metadata.DefaultComment)

Example 8 with DefaultComment

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

the class RetryMerger method generateRetryDefinitionsNode.

public ConfigNode generateRetryDefinitionsNode(ConfigNode prevNode) {
    FieldConfigNode retryCodesDefNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "retry_codes_def").setComment(new DefaultComment("Definition for retryable codes."));
    prevNode.insertNext(retryCodesDefNode);
    generateRetryCodesDefValueNode(retryCodesDefNode);
    FieldConfigNode retryParamsDefNode = new FieldConfigNode(NodeFinder.getNextLine(retryCodesDefNode), "retry_params_def").setComment(new DefaultComment("Definition for retry/backoff parameters."));
    retryCodesDefNode.insertNext(retryParamsDefNode);
    generateRetryParamsDefValueNode(retryParamsDefNode);
    return retryParamsDefNode;
}
Also used : FieldConfigNode(com.google.api.codegen.configgen.nodes.FieldConfigNode) DefaultComment(com.google.api.codegen.configgen.nodes.metadata.DefaultComment)

Example 9 with DefaultComment

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

the class ListItemConfigNodeTest method testComment.

@Test
public void testComment() throws Exception {
    ListItemConfigNode node = new ListItemConfigNode(0);
    Comment comment = new DefaultComment("Lorem ispum");
    Truth.assertThat(node.getComment().generate()).isEqualTo("");
    Truth.assertThat(node.setComment(comment)).isSameAs(node);
    Truth.assertThat(node.getComment()).isSameAs(comment);
}
Also used : DefaultComment(com.google.api.codegen.configgen.nodes.metadata.DefaultComment) Comment(com.google.api.codegen.configgen.nodes.metadata.Comment) DefaultComment(com.google.api.codegen.configgen.nodes.metadata.DefaultComment) Test(org.junit.Test)

Aggregations

DefaultComment (com.google.api.codegen.configgen.nodes.metadata.DefaultComment)9 FieldConfigNode (com.google.api.codegen.configgen.nodes.FieldConfigNode)7 ConfigNode (com.google.api.codegen.configgen.nodes.ConfigNode)4 ListItemConfigNode (com.google.api.codegen.configgen.nodes.ListItemConfigNode)3 Comment (com.google.api.codegen.configgen.nodes.metadata.Comment)2 Test (org.junit.Test)2 ScalarConfigNode (com.google.api.codegen.configgen.nodes.ScalarConfigNode)1