Class WildcardMatcher

java.lang.Object
io.confluent.kafka.schemaregistry.utils.WildcardMatcher

public class WildcardMatcher extends Object
A wildcard matcher.
  • Constructor Details

    • WildcardMatcher

      public WildcardMatcher()
  • Method Details

    • match

      public static boolean match(String str, String wildcardMatcher)
      Matches fully-qualified names that use dot (.) as the name boundary.

      A '?' matches a single character. A '*' matches one or more characters within a name boundary. A '**' matches one or more characters across name boundaries.

      Examples:

       wildcardMatch("eve", "eve*")                  --> true
       wildcardMatch("alice.bob.eve", "a*.bob.eve")  --> true
       wildcardMatch("alice.bob.eve", "a*.bob.e*")   --> true
       wildcardMatch("alice.bob.eve", "a*")          --> false
       wildcardMatch("alice.bob.eve", "a**")         --> true
       wildcardMatch("alice.bob.eve", "alice.bob*")  --> false
       wildcardMatch("alice.bob.eve", "alice.bob**") --> true
       
      Parameters:
      str - the string to match on
      wildcardMatcher - the wildcard string to match against
      Returns:
      true if the string matches the wildcard string