Class LensResolver

java.lang.Object
com.arc_e_tect.gradle.trackerlens.lens.LensResolver

public class LensResolver extends Object
Merges the Lenses contributed by several LensSources into the final set offered in the dashboard's lens switcher.

Within a single source, ids are already unique (enforced defensively by LensScanner). Across sources - built-in vs. external, or external vs. external, no distinction is made between the two - a colliding id is transparently auto-namespaced: the first source to contribute a given id keeps it clean, and every later source contributing the same id gets it suffixed with its source label in parentheses (e.g. "dark-lens (midnight-theme)"). This is a no-fail, always-succeeds merge: id collisions are expected and handled, never an error.

Sources are merged strictly in the order given, so a caller that wants one particular source to win a contested id outright (e.g. trackerLens.lensStylesheet, which must always keep its clean custom-lens id) achieves that simply by placing it first in the list - this class applies no other precedence rule.

  • Constructor Details

    • LensResolver

      public LensResolver()
      Creates a new LensResolver.
  • Method Details

    • resolve

      public List<ResolvedLens> resolve(List<LensSource> sources)
      Merges sources in order, auto-namespacing any id collision across sources.
      Parameters:
      sources - the contributors to merge, in precedence order
      Returns:
      the resolved lenses, in the order first discovered