aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/prelude/templates/Template.java
blob: 63bd3214b17f9364eca6c85592e7c7a2c075526b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.templates;

import java.io.Writer;


/**
 * A template turns a template string and some state into
 * an instantiated string. Add support for a particular
 * template mechanism by subclassing this.
 *
 * @author bratseth
 */
public abstract class Template<T extends Writer> {

    /**
     * Renders this template
     *
     * @param context the context to evaluate in
     * @param writer the writer to render to
     */
    public abstract void render(Context context,T writer)
        throws java.io.IOException;


    /**
     * Get template name
     *
     * @return template name
     */
    public abstract String getName();

}