001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.tools.template_engine;
003
004/**
005 * {@link TemplateEntry} representing a static string.
006 * <p>
007 * When compiling the template result, the given string will simply be inserted at the current position.
008 */
009public class StaticText implements TemplateEntry {
010
011    private final String staticText;
012
013    /**
014     * Create a new {@code StaticText}.
015     * @param staticText the text to insert verbatim
016     */
017    public StaticText(String staticText) {
018        this.staticText = staticText;
019    }
020
021    @Override
022    public void appendText(StringBuilder result, TemplateEngineDataProvider dataProvider) {
023        result.append(staticText);
024    }
025
026    @Override
027    public boolean isValid(TemplateEngineDataProvider dataProvider) {
028        return true;
029    }
030
031    @Override
032    public String toString() {
033        return staticText;
034    }
035}