blob: 640baae98acd8f69f15ed526a883ba43c76a64a9 (
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
34
35
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.task.util.template;
import com.yahoo.vespa.hosted.node.admin.task.util.text.CursorRange;
import java.util.Objects;
/**
* A section of a template text.
*
* @see Template
* @author hakonhall
*/
abstract class Section {
private final String type;
private final CursorRange range;
private Template template;
protected Section(String type, CursorRange range) {
this.type = type;
this.range = range;
}
void setTemplate(Template template) { this.template = template; }
/** Guaranteed to return non-null after TemplateBuilder::build() returns. */
protected Template template() { return Objects.requireNonNull(template); }
protected String type() { return type; }
protected CursorRange range() { return range; }
abstract void appendTo(StringBuilder buffer);
abstract void appendCopyTo(SectionList sectionList);
}
|