Class MatcherLookup

java.lang.Object
org.apache.ivy.core.module.id.MatcherLookup

public class MatcherLookup extends 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 Details

    • MatcherLookup

      public MatcherLookup()
  • Method Details

    • 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 List<MapMatcher> get(Map<String,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