Class SimpleScalar

java.lang.Object
freemarker.template.SimpleScalar
All Implemented Interfaces:
TemplateModel, TemplateScalarModel, Serializable

public final class SimpleScalar extends Object implements TemplateScalarModel, Serializable
A simple implementation of the TemplateScalarModel interface, using a String. As of version 2.0 this object is immutable.

This class is thread-safe.

See Also:
  • Constructor Details

    • SimpleScalar

      public SimpleScalar(String value)
      Constructs a SimpleScalar containing a string value.
      Parameters:
      value - the string value.
  • Method Details

    • getAsString

      public String getAsString()
      Description copied from interface: TemplateScalarModel
      Returns the string representation of this model. In general, avoid returning null. In compatibility mode the engine will convert null into empty string, however in normal mode it will throw an exception if you return null from this method.
      Specified by:
      getAsString in interface TemplateScalarModel
    • toString

      public String toString()
      Overrides:
      toString in class Object