Class DefaultPathFilter
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.filter.DefaultPathFilter
-
- All Implemented Interfaces:
Dumpable
,Filter
,PathFilter
public class DefaultPathFilter extends Object implements PathFilter
The default path filter provides hierarchical filtering.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.vault.fs.api.PathFilter
ALL, NONE
-
-
Constructor Summary
Constructors Constructor Description DefaultPathFilter()
Default constructorDefaultPathFilter(String pattern)
Creates a new default path filter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.boolean
equals(Object o)
String
getPattern()
Returns the patternint
hashCode()
boolean
isAbsolute()
Checks if the pattern is absolute, i.e. does not start with a wildcard.boolean
matches(String path)
Checks if the given path matches this filters criteria.void
setPattern(String pattern)
Sets the regexp pattern for this filter.String
toString()
PathFilter
translate(PathMapping mapping)
Translates this path filter with the given mapping.
-
-
-
Constructor Detail
-
DefaultPathFilter
public DefaultPathFilter()
Default constructor
-
DefaultPathFilter
public DefaultPathFilter(String pattern) throws ConfigurationException
Creates a new default path filter- Parameters:
pattern
- the pattern- Throws:
ConfigurationException
- in case an invalid regex pattern was given.- See Also:
setPattern(java.lang.String)
-
-
Method Detail
-
setPattern
public void setPattern(String pattern) throws ConfigurationException
Sets the regexp pattern for this filter. Examples:| Pattern | Matches | /foo | exactly "/foo" | /foo.* | all paths starting with "/foo" | ^.* /foo[^/]*$ | all files starting with "foo" | /foo/[^/]*$ | all direct children of /foo | /foo/.* | all children of /foo | /foo(/.*)? | all children of /foo and foo itself
- Parameters:
pattern
- the pattern.- Throws:
ConfigurationException
- in case an invalid regex pattern was given.
-
getPattern
public String getPattern()
Returns the pattern- Returns:
- the pattern
-
matches
public boolean matches(String path)
Checks if the given path matches this filters criteria.- Specified by:
matches
in interfacePathFilter
- Parameters:
path
- the path to check- Returns:
true
if this filter matches the criteria;false
otherwise.
-
isAbsolute
public boolean isAbsolute()
Checks if the pattern is absolute, i.e. does not start with a wildcard.- Specified by:
isAbsolute
in interfacePathFilter
- Returns:
true
if pattern is absolute
-
translate
public PathFilter translate(PathMapping mapping)
Translates this path filter with the given mapping. Note that only absolute filters can be translated.- Specified by:
translate
in interfacePathFilter
- Parameters:
mapping
- the mapping to apply- Returns:
- the new filter
-
dump
public void dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.
-
-