Package: org.gmetrics.util

## [Groovy] Class WildcardPattern

- org.gmetrics.util.WildcardPattern

- Represents a string pattern that may optionally include wildcards ('*', '**' or '?'), and provides an API to determine whether that pattern matches a specified input string.

  The wildcard character '*' within the pattern matches a sequence of zero or more characters within a single file or directory name in the input string. It does not match a sequence of two or more dir/file names. For instance, 'a*b' matches 'a12345b' and 'ab', but does NOT match 'a/b' or 'a123/b'.

  The '**' wildcard matches any sequence of zero or more characters in the input string, including directory names and separators . It matches any part of the directory tree. For instance, 'a**b' matches 'a12345b', 'ab', 'a/b' and 'a1/a2/a3b'.

  The wildcard character '?' within the pattern matches exactly one character in the input string, excluding the normalized file separator character ('/').

  This is an internal class and its API is subject to change.
  Authors:
    Chris Mair
  Version:
    \$Revision: 98 \$ - \$Date: 2010-03-09 21:45:10 -0500 (Tue, 09 Mar 2010) \$

- - ### Constructor Summary

    Constructors
    Constructor and description
    `WildcardPattern (String patternString, boolean defaultMatches = true)` Construct a new WildcardPattern instance on a single pattern or a comma-separated list of patterns.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `boolean` | `matches(String string)` Return true if the specified String matches the pattern or if the original patternString (specified in the constructor) was null or empty and the value for defaultMatches (also specified in the constructor) was true.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, toString, hashCode, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### WildcardPattern(String patternString, boolean defaultMatches = true)

      Construct a new WildcardPattern instance on a single pattern or a comma-separated list of patterns.

      Parameters:
        `patternString` - - the pattern string, optionally including wildcard characters ('*' or '?'); may optionally contain more than one pattern, separated by commas; may be null or empty to always match
        `defaultMatches` - - a boolean indicating whether `matches()` should return true if the pattern string is either empty or null. This parameter is optional and defaults to `true`.

  - ### Method Detail

    - #### boolean matches(String string)

      Return true if the specified String matches the pattern or if the original patternString (specified in the constructor) was null or empty and the value for defaultMatches (also specified in the constructor) was true.

      Parameters:
        `string` - - the String to check
      Returns:
        true if the String matches the pattern