All Downloads are FREE. Search and download functionalities are using the official Maven repository.

name.remal.gradle_plugins.toolkit.issues.IssuesRenderer Maven / Gradle / Ivy

There is a newer version: 0.69.7
Show newest version
package name.remal.gradle_plugins.toolkit.issues;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.Files.write;
import static name.remal.gradle_plugins.toolkit.PathUtils.createParentDirectories;
import static name.remal.gradle_plugins.toolkit.PathUtils.normalizePath;

import java.io.File;
import java.nio.file.Path;
import lombok.SneakyThrows;
import lombok.val;

public interface IssuesRenderer {

    String renderIssues(Iterable issues);

    @SneakyThrows
    default void renderIssuesToPath(Iterable issues, Path path) {
        val content = renderIssues(issues);
        path = normalizePath(path);
        createParentDirectories(path);
        write(path, content.getBytes(UTF_8));
    }

    default void renderIssuesToFile(Iterable issues, File file) {
        renderIssuesToPath(issues, file.toPath());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy