Class GlobPathFilter

  • All Implemented Interfaces:
    PathFilter

    final class GlobPathFilter
    extends java.lang.Object
    implements PathFilter
    Default implementation of PathFilter. Uses glob based includes and excludes to determine whether to export.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String glob  
      private static java.util.regex.Pattern GLOB_PATTERN  
      private java.util.regex.Pattern pattern  
    • Constructor Summary

      Constructors 
      Constructor Description
      GlobPathFilter​(java.lang.String glob)
      Construct a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.lang.String path)
      Determine whether a path should be accepted.
      boolean equals​(java.lang.Object obj)
      Determine whether this filter is equal to another.
      boolean equals​(GlobPathFilter obj)  
      private static java.util.regex.Pattern getGlobPattern​(java.lang.String glob)
      Get a regular expression pattern which accept any path names which match the given glob.
      int hashCode()
      Calculate a unique hash code for this path filter.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • GLOB_PATTERN

        private static final java.util.regex.Pattern GLOB_PATTERN
      • glob

        private final java.lang.String glob
      • pattern

        private final java.util.regex.Pattern pattern
    • Constructor Detail

      • GlobPathFilter

        GlobPathFilter​(java.lang.String glob)
        Construct a new instance.
        Parameters:
        glob - the path glob to match
    • Method Detail

      • accept

        public boolean accept​(java.lang.String path)
        Determine whether a path should be accepted.
        Specified by:
        accept in interface PathFilter
        Parameters:
        path - the path to check
        Returns:
        true if the path should be accepted, false if not
      • getGlobPattern

        private static java.util.regex.Pattern getGlobPattern​(java.lang.String glob)
        Get a regular expression pattern which accept any path names which match the given glob. The glob patterns function similarly to ant file patterns. Valid metacharacters in the glob pattern include:
        • "\" - escape the next character (treat it literally, even if it is itself a recognized metacharacter)
        • "?" - match any non-slash character
        • "*" - match zero or more non-slash characters
        • "**" - match zero or more characters, including slashes
        • "/" - match one or more slash characters. Consecutive / characters are collapsed down into one.
        In addition, any glob pattern matches all subdirectories thereof. A glob pattern ending in / is equivalent to a glob pattern ending in /** in that the named directory is not itself included in the glob.

        See also: "Patterns" in the Ant Manual

        Parameters:
        glob - the glob to match
        Returns:
        the pattern
      • hashCode

        public int hashCode()
        Description copied from interface: PathFilter
        Calculate a unique hash code for this path filter. Equal path filters must yield identical hash codes.
        Specified by:
        hashCode in interface PathFilter
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code
      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from interface: PathFilter
        Determine whether this filter is equal to another. Filters must implement meaningful (non-identity) equality semantics.
        Specified by:
        equals in interface PathFilter
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the other object
        Returns:
        true if this filter is the same
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object