Class 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();

    At the moment all logging is forwarded to LOG4J. In Velocity 2.0 there will be an adapter for SLF4J and we'll use it: Slf4jLogChute.

    The class is mutable and thread-safe.

    Since:
    0.1.6
    See Also:
    Velocity User Guide, Velocity Developer Guide, Slf4jLogChute
    • Constructor Detail

      • 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 Detail

      • 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