Class FileExtensionMatcher

java.lang.Object
freemarker.cache.TemplateSourceMatcher
freemarker.cache.FileExtensionMatcher

public class FileExtensionMatcher extends TemplateSourceMatcher
Matches the file extension; unlike other matchers, by default case insensitive. A name (a path) is considered to have the given extension exactly if it ends with a dot plus the extension.
Since:
2.3.24
  • Constructor Details

    • FileExtensionMatcher

      public FileExtensionMatcher(String extension)
      Parameters:
      extension - The file extension (without the initial dot). Can't contain there characters: '/', '*', '?'. May contains '.', but can't start with it.
  • Method Details

    • matches

      public boolean matches(String sourceName, Object templateSource) throws IOException
      Throws:
      IOException
    • isCaseInsensitive

      public boolean isCaseInsensitive()
    • setCaseInsensitive

      public void setCaseInsensitive(boolean caseInsensitive)
      Sets if the matching will be case insensitive (UNICODE compliant); default is true.
    • caseInsensitive

      public FileExtensionMatcher caseInsensitive(boolean caseInsensitive)
      Fluid API variation of setCaseInsensitive(boolean)