Class PropertyNamesMatcher<T>

java.lang.Object
io.smallrye.config.PropertyNamesMatcher<T>
Direct Known Subclasses:
DefaultValuesConfigSource.Defaults

public class PropertyNamesMatcher<T> extends Object
A matcher of configuration names.

Names without wildcards are stored in a HashMap for exact lookup. Names containing * or ** are stored in a trie of PropertyNamesMatcher.Node instances, where each node represents a segment separated by .. Single * segments are stored in the PropertyNamesMatcher.Node.wildcard, and ** sets the PropertyNamesMatcher.Node.greedy flag to match any number of remaining segments.

Lookups (matches(java.lang.String) and get(java.lang.String)) first check the exact-match map, then traverse the wildcard trie, trying named children before falling back to wildcard nodes at each level.

  • Constructor Details

    • PropertyNamesMatcher

      protected PropertyNamesMatcher()
  • Method Details

    • getProperties

      protected Map<String,T> getProperties()
    • getWildcards

      protected PropertyNamesMatcher.Node<T> getWildcards()
    • isEmpty

      public boolean isEmpty()
    • matches

      public boolean matches(String name)
      Match a name with any of the names contained in this matcher.
      Parameters:
      name - the String to be matched
      Returns:
      true if matched or false otherwise.
    • get

      public T get(String name)
      Returns the value matching a name with any of the names contained in this matcher.
      Parameters:
      name - the String to be matched
      Returns:
      a T value if the name matches or null otherwise.
    • add

      protected void add(String name)
    • add

      protected void add(Set<String> names)
    • add

      protected void add(Map<String,T> properties)
    • add

      protected void add(String name, T value)
    • put

      protected void put(Map<String,T> properties)
    • put

      protected void put(String name, T value)