Class TextTemplate

    • Constructor Detail

      • TextTemplate

        public TextTemplate​(String contentType)
        Constructor.
        Parameters:
        contentType - the mime type of this resource, such as "image/jpeg" or " text/html"
    • Method Detail

      • asString

        public String asString​(Map<String,​?> variables)
        Interpolates the Map of variables with the content and returns the resulting String without replacing the content. Variables are denoted in this string by the syntax ${variableName}. The contents will be altered by replacing each variable of the form ${variableName} with the value returned by variables.getValue("variableName").
        Parameters:
        variables - the variables to interpolate
        Returns:
        the result of the interpolation
      • interpolate

        public abstract TextTemplate interpolate​(Map<String,​?> variables)
        Interpolates values into this TextTemplate.
        Parameters:
        variables - variables to interpolate into this TextTemplate
        Returns:
        this, for chaining purposes