Search in sources :

Example 1 with Printer

use of org.eclipse.winery.yaml.common.writer.yaml.support.Printer in project winery by eclipse.

the class Writer method printMapObject.

private Printer printMapObject(String keyValue, Map<String, ? extends Object> map, Parameter parameter) {
    Printer printer = new Printer(parameter.getIndent());
    if (!map.isEmpty()) {
        printer.printCheckNewLine().printKey(keyValue).indent(INDENT_SIZE);
        map.forEach(printer::printKeyObject);
        printer.indent(-INDENT_SIZE);
    }
    return printer;
}
Also used : Printer(org.eclipse.winery.yaml.common.writer.yaml.support.Printer)

Example 2 with Printer

use of org.eclipse.winery.yaml.common.writer.yaml.support.Printer in project winery by eclipse.

the class Writer method visit.

public Printer visit(Metadata node, Parameter parameter) {
    Printer printer = new Printer(parameter.getIndent());
    if (!node.isEmpty()) {
        printer.printKey("metadata").indent(INDENT_SIZE);
        node.forEach(printer::printKeyValue);
        printer.indent(-INDENT_SIZE);
    }
    return printer;
}
Also used : Printer(org.eclipse.winery.yaml.common.writer.yaml.support.Printer)

Example 3 with Printer

use of org.eclipse.winery.yaml.common.writer.yaml.support.Printer in project winery by eclipse.

the class Writer method visit.

public Printer visit(TRepositoryDefinition node, Parameter parameter) {
    Printer printer = new Printer(parameter.getIndent()).printKeyValue("description", node.getDescription()).printKeyValue("url", node.getUrl());
    if (Objects.nonNull(node.getCredential())) {
        Credential credential = node.getCredential();
        printer.printKey("credential").indent(INDENT_SIZE).printKeyValue("protocol", credential.getProtocol()).printKeyValue("token_type", credential.getTokenType()).printKeyValue("token", credential.getToken()).printKeyObject("keys", credential.getKeys()).printKeyValue("user", credential.getUser()).indent(-INDENT_SIZE);
    }
    return printer;
}
Also used : Credential(org.eclipse.winery.model.tosca.yaml.tosca.datatypes.Credential) Printer(org.eclipse.winery.yaml.common.writer.yaml.support.Printer)

Aggregations

Printer (org.eclipse.winery.yaml.common.writer.yaml.support.Printer)3 Credential (org.eclipse.winery.model.tosca.yaml.tosca.datatypes.Credential)1