Class DefaultPathFilter

  • All Implemented Interfaces:
    Dumpable, Filter, PathFilter

    public class DefaultPathFilter
    extends java.lang.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 constructor
      DefaultPathFilter​(java.lang.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​(java.lang.Object o)
      java.lang.String getPattern()
      Returns the pattern
      int hashCode()
      boolean isAbsolute()
      Checks if the pattern is absolute, i.e.
      boolean matches​(java.lang.String path)
      Checks if the given path matches this filters criteria.
      void setPattern​(java.lang.String pattern)
      Sets the regexp pattern for this filter.
      PathFilter translate​(PathMapping mapping)
      Translates this path filter with the given mapping.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultPathFilter

        public DefaultPathFilter()
        Default constructor
      • DefaultPathFilter

        public DefaultPathFilter​(java.lang.String pattern)
        Creates a new default path filter
        Parameters:
        pattern - the pattern
        See Also:
        setPattern(java.lang.String)
    • Method Detail

      • setPattern

        public void setPattern​(java.lang.String pattern)
        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.
      • getPattern

        public java.lang.String getPattern()
        Returns the pattern
        Returns:
        the pattern
      • matches

        public boolean matches​(java.lang.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​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.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