public class FilePattern extends Object implements ResourcePattern
expression:
(segment "/")* segment
segment:
traverse
directory
traverse:
"**" "/"
directory:
resource "/"
file:
resource
resource:
token (wildcard token)* wildcard?
wildcard (token wildcard)* token?
token:
variable
character+
wildcard:
"*"
variable:
"${" character* "}"
character:
(any character except "/", "\", "$", "*", "?", "#", "{", "}", "[", "]")
Expression | Description |
---|---|
a/b/c.csv |
just a/b/c.csv |
* |
all files in target directory |
** |
all files in target directory (recursive) |
*.csv |
all CSV files in target directory |
**/*.csv |
all CSV files in target directory (recursive) |
Modifier and Type | Class and Description |
---|---|
static interface |
FilePattern.PatternElement
A piece of file/directory name pattern.
|
static class |
FilePattern.PatternElementKind
Kind of
FilePattern.PatternElement . |
static class |
FilePattern.Segment
Each segment in
FilePattern . |
static class |
FilePattern.Selection
Represents a selecion.
|
static class |
FilePattern.Variable
Represents a variable.
|
Modifier and Type | Method and Description |
---|---|
static FilePattern |
compile(String patternString)
Compiles pattern expression.
|
boolean |
containsTraverse()
Returns whether this pattern contains traverse (
** ). |
boolean |
containsVariables()
Returns whether this pattern contains variables (${var}).
|
Set<FilePattern.PatternElementKind> |
getPatternElementKinds()
Returns the pattern element kinds appeared in this pattern.
|
String |
getPatternString()
Returns a string which represents this pattern.
|
List<FilePattern.Segment> |
getSegments()
Returns segments of this pattern.
|
static FilePattern |
of(List<? extends FilePattern.Segment> segments)
Returns a pattern of the given segments.
|
String |
toString() |
public Set<FilePattern.PatternElementKind> getPatternElementKinds()
public boolean containsVariables()
true
if containspublic boolean containsTraverse()
**
).true
if containspublic List<FilePattern.Segment> getSegments()
public String getPatternString()
public static FilePattern of(List<? extends FilePattern.Segment> segments)
segments
- the pattern segmentspublic static FilePattern compile(String patternString)
patternString
- pattern expressionIllegalArgumentException
- if pattern is not validCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.