Class HtmlTemplate


  • public class HtmlTemplate
    extends java.lang.Object
    This class represents an HTML template that may include bookmarks that can be substitute by values.
    Version:
    1.2.5
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getHtml()
      Returns the template.
      void load​(java.io.InputStream is)
      Load the template from an InputStream
      void load​(java.lang.String strFilename)
      Load the template from a file
      void substitute​(java.lang.String strBookmark, int nValue)
      Substitute each appearance of a bookmark by a given value.
      void substitute​(java.lang.String strBookmark, java.lang.String strValue)
      Substitute each appearance of a bookmark by a given value.
      void substitute​(java.lang.String strBookmark, java.sql.Date date)
      Substitute each appearance of a bookmark by a given value.
      void substitute​(java.lang.String strBookmark, java.sql.Timestamp date)
      Substitute each occurence of a bookmark by a given value.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HtmlTemplate

        public HtmlTemplate()
        Constructor 1
      • HtmlTemplate

        public HtmlTemplate​(java.lang.String strTemplate)
        Constructor 2
        Parameters:
        strTemplate - The template as a string
      • HtmlTemplate

        public HtmlTemplate​(HtmlTemplate template)
        Constructor 3
        Parameters:
        template - Copy constructor based on another template.
    • Method Detail

      • load

        public void load​(java.lang.String strFilename)
                  throws java.io.IOException
        Load the template from a file
        Parameters:
        strFilename - The file name to load
        Throws:
        java.io.IOException - If an error occured
      • load

        public void load​(java.io.InputStream is)
                  throws java.io.IOException
        Load the template from an InputStream
        Parameters:
        is - The open InputStream that point on the template
        Throws:
        java.io.IOException - If an error occured
      • getHtml

        public java.lang.String getHtml()
        Returns the template.
        Returns:
        The template as a string.
      • substitute

        public void substitute​(java.lang.String strBookmark,
                               java.lang.String strValue)
        Substitute each appearance of a bookmark by a given value.
        Parameters:
        strBookmark - The bookmark that must be present in the template.
        strValue - The value to substitute as a String.
      • substitute

        public void substitute​(java.lang.String strBookmark,
                               int nValue)
        Substitute each appearance of a bookmark by a given value.
        Parameters:
        strBookmark - The bookmark that must be present in the template.
        nValue - The value to substitute as an integer.
      • substitute

        public void substitute​(java.lang.String strBookmark,
                               java.sql.Date date)
        Substitute each appearance of a bookmark by a given value.
        Parameters:
        strBookmark - The bookmark that must be present in the template.
        date - The value to substitute as a Date.
      • substitute

        public void substitute​(java.lang.String strBookmark,
                               java.sql.Timestamp date)
        Substitute each occurence of a bookmark by a given value.
        Parameters:
        strBookmark - The bookmark that must be present in the template.
        date - The value to substitute as a Timestamp.