Interface LookupMerger<T>

Type Parameters:
T - the type of object being merged (see Project.getLookup() for examples)

public interface LookupMerger<T>
Allows project lookup to merge instances of known classes and replace them with single instance. To be used in conjunction with the LookupProvider and LookupProviderSupport The interface is to be implemented by the project owner which decides which contracts make sense to have merged and how they are to be merged. The 3rd party LookupProvider implementors provide instances of mergeableClass. LookupProviderSupport.createCompositeLookup(org.openide.util.Lookup, java.lang.String) handles the hiding of individual mergeable instances and exposing the merged instance created by the LookupMerger.
Since:
org.netbeans.modules.projectapi 1.12
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static @interface 
    Registers a lookup merger for some project types.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a class which is merged by this implementation of LookupMerger
    merge(org.openide.util.Lookup lookup)
    Merge instances of the given class in the given lookup and return merged object which substitutes them.
  • Method Details

    • getMergeableClass

      Class<T> getMergeableClass()
      Returns a class which is merged by this implementation of LookupMerger
      Returns:
      Class instance
    • merge

      T merge(org.openide.util.Lookup lookup)
      Merge instances of the given class in the given lookup and return merged object which substitutes them.
      Parameters:
      lookup - lookup with the instances
      Returns:
      object to be used instead of instances in the lookup