Class VelocityPage

java.lang.Object
com.jcabi.velocity.VelocityPage

public final class VelocityPage extends Object
Velocity page, builder/wrapper around Apache Velocity template.

The template should be in classpath:

 String text = new VelocityPage("com/foo/my-template.vm")
   .set("name", "John Doe")
   .toString();

Logging is forwarded to SLF4J by Apache Velocity 2.x.

The class is mutable and thread-safe.

Since:
0.1.6
See Also:
  • Constructor Details

    • VelocityPage

      public VelocityPage(String res)
      Public ctor, with absolute resource name in classpath.
      Parameters:
      res - Name of resource with template (absolute resource name in classpath)
  • Method Details

    • set

      public VelocityPage set(String prop, Object value)
      Set the name to the value specified.
      Parameters:
      prop - Name of the property to set
      value - The value to use
      Returns:
      This object
    • set

      public VelocityPage set(Map<String,Object> args)
      Set all names in one go.
      Parameters:
      args - Map of arguments
      Returns:
      This object
      Since:
      0.8
    • toString

      public String toString()
      Overrides:
      toString in class Object