RegexpMatcherFactory (Apache Ant API)
Date: 2018-03-24

org.apache.tools.ant.util.regexp

## Class RegexpMatcherFactory

- java.lang.Object
- - org.apache.tools.ant.util.regexp.RegexpMatcherFactory

- Direct Known Subclasses:
    RegexpFactory

      public class RegexpMatcherFactory
      extends java.lang.Object

  Simple Factory Class that produces an implementation of RegexpMatcher based on the system property `ant.regexp.regexpimpl` and the classes available.

  In a more general framework this class would be abstract and have a static newInstance method.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RegexpMatcherFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected RegexpMatcher` | `createInstance(java.lang.String className)` Create an instance of a matcher from a classname.
    `RegexpMatcher` | `newRegexpMatcher()` Create a new regular expression instance.
    `RegexpMatcher` | `newRegexpMatcher(Project p)` Create a new regular expression instance.
    `static boolean` | `regexpMatcherPresent(Project project)` Checks if a RegExp-Matcher is available.
    `protected void` | `testAvailability(java.lang.String className)` Test if a particular class is available to be used.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RegexpMatcherFactory

          public RegexpMatcherFactory()

  - ### Method Detail

    - #### newRegexpMatcher

          public RegexpMatcher newRegexpMatcher()
                                         throws BuildException

      Create a new regular expression instance.
      Returns:
        the matcher
      Throws:
        `BuildException` - on error

    - #### newRegexpMatcher

          public RegexpMatcher newRegexpMatcher(Project p)
                                         throws BuildException

      Create a new regular expression instance.
      Parameters:
        `p` - Project whose ant.regexp.regexpimpl property will be used.
      Returns:
        the matcher
      Throws:
        `BuildException` - on error

    - #### createInstance

          protected RegexpMatcher createInstance(java.lang.String className)
                                          throws BuildException

      Create an instance of a matcher from a classname.
      Parameters:
        `className` - a `String` value
      Returns:
        a `RegexpMatcher` value
      Throws:
        `BuildException` - if an error occurs

    - #### testAvailability

          protected void testAvailability(java.lang.String className)
                                   throws BuildException

      Test if a particular class is available to be used.
      Parameters:
        `className` - a `String` value
      Throws:
        `BuildException` - if an error occurs

    - #### regexpMatcherPresent

          public static boolean regexpMatcherPresent(Project project)

      Checks if a RegExp-Matcher is available.
      Parameters:
        `project` - The project to check for (may be `null`)
      Returns:
        `true` if available otherwise `false`