public class PathGlobMatcher extends TemplateSourceMatcher
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):
/
, because template names (template paths) never start with
it.
/
. Hence, foo/bar
refers to the file {bar}, while
foo/bar/
refers to the {bar} directory.
By default the glob is case sensitive, but this can be changed with setCaseInsensitive(boolean)
(or
caseInsensitive(boolean)
).
Constructor and Description |
---|
PathGlobMatcher(java.lang.String glob) |
Modifier and Type | Method and Description |
---|---|
PathGlobMatcher |
caseInsensitive(boolean caseInsensitive)
Fluid API variation of
setCaseInsensitive(boolean) |
boolean |
isCaseInsensitive() |
boolean |
matches(java.lang.String sourceName,
java.lang.Object templateSource) |
void |
setCaseInsensitive(boolean caseInsensitive)
Sets if the matching will be case insensitive (UNICODE compliant); default is
false . |
public PathGlobMatcher(java.lang.String glob)
glob
- Glob with the syntax defined by StringUtil.globToRegularExpression(String, boolean)
. Must not
start with /
.public boolean matches(java.lang.String sourceName, java.lang.Object templateSource) throws java.io.IOException
java.io.IOException
public boolean isCaseInsensitive()
public void setCaseInsensitive(boolean caseInsensitive)
false
.public PathGlobMatcher caseInsensitive(boolean caseInsensitive)
setCaseInsensitive(boolean)