Class TemplateFilter

  • All Implemented Interfaces:
    Filter

    class TemplateFilter
    extends java.lang.Object
    implements Filter
    The TemplateFilter class is used to provide variables to the template engine. This template acquires variables from two different sources. Firstly this will consult the user contextual Context object, which can contain variables that have been added during the deserialization process. If a variable is not present from this context it asks the Filter that has been specified by the user.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Context context
      This is the template context object used by the persister.
      private Filter filter
      This is the filter object provided to the persister.
    • Constructor Summary

      Constructors 
      Constructor Description
      TemplateFilter​(Context context, Filter filter)
      Constructor for the TemplateFilter object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String replace​(java.lang.String name)
      This will acquire the named variable value if it exists.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • context

        private Context context
        This is the template context object used by the persister.
      • filter

        private Filter filter
        This is the filter object provided to the persister.
    • Constructor Detail

      • TemplateFilter

        public TemplateFilter​(Context context,
                              Filter filter)
        Constructor for the TemplateFilter object. This creates a filter object that acquires template values from two different contexts. Firstly the Context is queried for a variables followed by the Filter.
        Parameters:
        context - this is the context object for the persister
        filter - the filter that has been given to the persister
    • Method Detail

      • replace

        public java.lang.String replace​(java.lang.String name)
        This will acquire the named variable value if it exists. If the named variable cannot be found in either the context or the user specified filter then this returns null.
        Specified by:
        replace in interface Filter
        Parameters:
        name - this is the name of the variable to acquire
        Returns:
        this returns the value mapped to the variable name