Class ConfigPatternMap<T>

  • All Implemented Interfaces:
    Iterable<T>

    public final class ConfigPatternMap<T>
    extends Object
    implements Iterable<T>
    A pattern-matching mapping of configuration key pattern to value.
    • Constructor Detail

      • ConfigPatternMap

        public ConfigPatternMap()
    • Method Detail

      • match

        public T match​(String name)
        Find the item which matches the given configuration key.
        Parameters:
        name - the configuration key (must not be null)
        Returns:
        the matching item
      • match

        public T match​(NameIterator nameIterator)
        Find the item which matches the given configuration key iterator.
        Parameters:
        nameIterator - the configuration key iterator (must not be null)
        Returns:
        the matching item
      • addPattern

        public boolean addPattern​(String pattern,
                                  T onMatch)
        Add a pattern to the map. The segments of the pattern are dot-separated. The special segment name {*} will match any single segment name. The special segment name {**} will eagerly match any segment name sequence.
        Parameters:
        pattern - the pattern (must not be null)
        onMatch - the value to return when the pattern is matched (must not be null)
        Returns:
        true if the pattern is a new unique pattern, or if the pattern exists but the given value is equal to the existing value; false if the pattern exists but the given value is not equal to the existing value
      • addPattern

        boolean addPattern​(NameIterator nameIterator,
                           T onMatch)
      • getMatched

        public T getMatched()
      • setMatched

        public void setMatched​(T matched)