Class FallbackMustacheFactory

  • All Implemented Interfaces:
    MustacheFactory

    public class FallbackMustacheFactory
    extends DefaultMustacheFactory
    Mustache.java factory with a fallback mechanism for locating resources. (Some parts are based on DefaultMustacheFactory code that is Copyright 2010 RightTime, Inc.)
    • Field Detail

      • resourceRoots

        private java.lang.Object[] resourceRoots
        List of fallback resource roots to search through.
    • Constructor Detail

      • FallbackMustacheFactory

        public FallbackMustacheFactory​(java.lang.String resourceRoot,
                                       java.lang.String fallbackRoot)
        Simple constructor for a fallback Mustache.java factory.
        Parameters:
        resourceRoot - normal resource root
        fallbackRoot - fallback alternative root
      • FallbackMustacheFactory

        public FallbackMustacheFactory​(java.io.File fileRoot,
                                       java.io.File fallbackRoot)
        Simple constructor for a fallback Mustache.java factory.
        Parameters:
        fileRoot - normal resource root
        fallbackRoot - fallback alternative root
      • FallbackMustacheFactory

        public FallbackMustacheFactory​(java.lang.Object... resourceRoots)
        Generic constructor for a fallback Mustache.java factory.
        Parameters:
        resourceRoots - array of fallback resource roots as String or File
    • Method Detail

      • getReader

        public java.io.Reader getReader​(java.lang.String resourceName)
        Return a reader for accessing resource files.
        Specified by:
        getReader in interface MustacheFactory
        Overrides:
        getReader in class DefaultMustacheFactory
        Parameters:
        resourceName - resource name relative to one of the fallback resource roots
        Returns:
        resource file reader