Package com.jamierf.dropwizard.debpkg.template

Source Code of com.jamierf.dropwizard.debpkg.template.Templater

package com.jamierf.dropwizard.debpkg.template;

import com.jamierf.dropwizard.debpkg.template.mustache.MustacheTemplater;

import java.io.*;

public abstract class Templater {

    public static Templater getDefault() {
        return new MustacheTemplater();
    }

    public abstract void execute(final Reader input, final Writer output, final String name, final Object parameters);

    public String execute(final String input, final String name, final Object parameters) throws IOException {
        if (input == null) {
            return null;
        }

        try (final Reader reader = new StringReader(input)) {
            final StringWriter writer = new StringWriter();
            execute(reader, writer, name, parameters);
            return writer.toString();
        }
    }
}
TOP

Related Classes of com.jamierf.dropwizard.debpkg.template.Templater

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.