Package org.gradle.util

# Class NameMatcher

java.lang.Object
org.gradle.util.NameMatcher

@Deprecated public class NameMatcher extends Object
Deprecated.
Will be removed in Gradle 9.0.
This class is only here to maintain binary compatibility with existing plugins.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NameMatcher()`
  Deprecated.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `find(String pattern, Collection<String> items)`
  Deprecated.
  Locates the best match for a camel case pattern in a collection.
  `<T> T`
  `find(String pattern, Map<String,? extends T> items)`
  Deprecated.
  Locates the best match for a camel case pattern in a key set of a map and returns the corresponding value.
  `String`
  `formatErrorMessage(String singularItemDescription, Object container)`
  Deprecated.
  Returns a formatted error message describing why the pattern matching failed.
  `Set<String>`
  `getCandidates()`
  Deprecated.
  Returns the potential matches, if any.
  `Set<String>`
  `getMatches()`
  Deprecated.
  Returns all matches, when there were more than 1.

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

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

- ## Constructor Details

  - ### NameMatcher

    public NameMatcher()
    Deprecated.

- ## Method Details

  - ### find

    public <T> T find(String pattern, Map<String,? extends T> items)
    Deprecated.
    Locates the best match for a camel case pattern in a key set of a map and returns the corresponding value.
    Returns:
      The matching item if exactly 1 match found, null if no matches or multiple matches.
    See Also:
      - `find(String, Collection)`

  - ### find

    public String find(String pattern, Collection<String> items)
    Deprecated.
    Locates the best match for a camel case pattern in a collection.

    The pattern is expanded to match on camel case and on kebab case strings. For example, the pattern `gBD` matches to `gradleBinaryDistribution` and `gradle-binary-distribution`.

    The method will return `null` if the pattern is an empty string.

    If the target collection contains the pattern string then the method omits the pattern matching and returns the pattern.

    Returns:
      The match if exactly 1 match found, null if no matches or multiple matches.

  - ### getMatches

    public Set<String> getMatches()
    Deprecated.
    Returns all matches, when there were more than 1.
    Returns:
      The matches. Returns an empty set when there are no matches.

  - ### getCandidates

    public Set<String> getCandidates()
    Deprecated.
    Returns the potential matches, if any.
    Returns:
      The matches. Returns an empty set when there are no potential matches.

  - ### formatErrorMessage

    public String formatErrorMessage(String singularItemDescription, Object container)
    Deprecated.
    Returns a formatted error message describing why the pattern matching failed.
    Returns:
      The error message.