Package freemarker.cache
Class PathGlobMatcher
java.lang.Object
freemarker.cache.TemplateSourceMatcher
freemarker.cache.PathGlobMatcher
Matches the whole template source name (also known as template source path) with the given glob.
Note that the template source name is relative to the template storage root defined by the
TemplateLoader
;
it's not the full path of a file on the file system.
This glob implementation recognizes **
(Ant-style directory wildcard) among others. For more details see
StringUtil.globToRegularExpression(String, boolean)
.
About the usage of /
(slash):
- You aren't allowed to start the glob with
/
, because template names (template paths) never start with it. - Future FreeMarker versions (compared to 2.3.24) might will support importing whole directories. Directory paths
in FreeMarker should end with
/
. Hence,foo/bar
refers to the file {bar}, whilefoo/bar/
refers to the {bar} directory.
By default the glob is case sensitive, but this can be changed with setCaseInsensitive(boolean)
(or
caseInsensitive(boolean)
).
- Since:
- 2.3.24
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncaseInsensitive(boolean caseInsensitive)
Fluid API variation ofsetCaseInsensitive(boolean)
boolean
boolean
void
setCaseInsensitive(boolean caseInsensitive)
Sets if the matching will be case insensitive (UNICODE compliant); default isfalse
.
-
Constructor Details
-
PathGlobMatcher
- Parameters:
glob
- Glob with the syntax defined byStringUtil.globToRegularExpression(String, boolean)
. Must not start with/
.
-
-
Method Details
-
matches
- Throws:
IOException
-
isCaseInsensitive
public boolean isCaseInsensitive() -
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive)Sets if the matching will be case insensitive (UNICODE compliant); default isfalse
. -
caseInsensitive
Fluid API variation ofsetCaseInsensitive(boolean)
-