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.
  • Constructor Details

  • Method Details

    • 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 interface PathFilter
      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 interface PathFilter
      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 interface PathFilter
      Parameters:
      mapping - the mapping to apply
      Returns:
      the new filter
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • dump

      public void dump(DumpContext ctx, boolean isLast)
      Dumps some human readable information using the given context.
      Specified by:
      dump in interface Dumpable
      Parameters:
      ctx - the dump context
      isLast - specifies if this is the last element to dump on this level