View Javadoc
1   /**************************************************************************
2    *
3    * Copyright (c) 2016-2019 Yawg project contributors.
4    *
5    **************************************************************************/
6   
7   package com.varmateo.yawg.spi;
8   
9   import java.io.Writer;
10  
11  import com.varmateo.yawg.api.Result;
12  
13  
14  /**
15   * Layout template for a baked page.
16   */
17  public interface Template {
18  
19  
20      /**
21       * Generates the final document from this template.
22       *
23       * @param context Input data for the document content generation
24       * process.
25       *
26       * @param output Sink where the document content is to be written
27       * to.
28       *
29       * @return A result signaling success, or failure. A failure could
30       * be caused during the processing of the template, or writing
31       * into the given {@code Writer}.
32       */
33      Result<Void> process(
34              TemplateContext context,
35              Writer output);
36  }