Class MatcherLookup


  • public class MatcherLookup
    extends java.lang.Object
    This class targets to speed up lookup for exact pattern matcher by keys, which are created with (organization, module) information. When exact pattern matcher is added, the key is created from matcher's attributes. When matcher is looked up against specific module, the key is recreated from module's attributes.

    The lookup doesn't target to speed up lookup for non exact pattern matcher. All non exact matchers are placed in non-keyed collection.

    At lookup for matchers against specific module, all non exact pattern matchers are iterated to match with module attributes, and exact pattern matchers binding to the same key will also iterated to match with module attributes.

    If there are much more exact pattern matchers than non exact pattern matchers, the matcher lookup speed can benefit from this class significantly. A quick example could be user declares lots of dependencyOverrides which are typically exact pattern matchers.

    If there are balanced exact and non exact pattern matchers, the matcher lookup speed doesn't hurt by this class.

    • Constructor Summary

      Constructors 
      Constructor Description
      MatcherLookup()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(MapMatcher matcher)
      Add matcher.
      java.util.List<MapMatcher> get​(java.util.Map<java.lang.String,​java.lang.String> attrs)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MatcherLookup

        public MatcherLookup()
    • Method Detail

      • add

        public void add​(MapMatcher matcher)
        Add matcher. If matcher is exact pattern matcher, it will be associated with a key and placed in keyed collection. If matcher is not exact pattern matcher, it will be placed into non-keyed collection
        Parameters:
        matcher - MapMatcher
      • get

        public java.util.List<MapMatcher> get​(java.util.Map<java.lang.String,​java.lang.String> attrs)
        Parameters:
        attrs - A map of attributes that matcher should match.
        Returns:
        a list of matchers that can apply to module withs specified attributes