org.openide.util.lookup

## Class AbstractLookup.Content

- java.lang.Object
- - org.openide.util.lookup.AbstractLookup.Content

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    InstanceContent
  Enclosing class:
    AbstractLookup

      public static class AbstractLookup.Content
      extends Object
      implements Serializable

  A class that can be used by the creator of the `AbstractLookup` to control its content (a kind of Privileged API giving creator of the lookup more rights than subsequent users of the lookup). Typical usage:

       AbstractLookup.Content ic = new InstanceContent();
       Lookup lookup = new AbstractLookup(ic);
       ic.addPair(...);

  Since:
    1.25
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Content()` Default constructor.
    `Content(Executor notifyIn)` Creates a content associated with an executor to handle dispatch of changes.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPair(AbstractLookup.Pair<?> pair)` The method to add a pair to the associated `AbstractLookup`.
    `void` | `removePair(AbstractLookup.Pair<?> pair)` Remove instance.
    `void` | `setPairs(Collection<? extends AbstractLookup.Pair> c)` Changes all pairs in the lookup to new values.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Content

          public Content()

      Default constructor.

    - #### Content

          public Content(Executor notifyIn)

      Creates a content associated with an executor to handle dispatch of changes.
      Parameters:
        `notifyIn` - the executor to notify changes in
      Since:
        7.16

  - ### Method Detail

    - #### addPair

          public final void addPair(AbstractLookup.Pair<?> pair)

      The method to add a pair to the associated `AbstractLookup`. Preferably call this method when lookup is already associated with this content (association is done by passing this object to some `AbstractLookup's constructor` once).
      Parameters:
        `pair` - class/instance pair
      Throws:
        `NullPointerException` - may throw NullPointerException if called before association with `AbstractLookup`

    - #### removePair

          public final void removePair(AbstractLookup.Pair<?> pair)

      Remove instance.
      Parameters:
        `pair` - class/instance pair

    - #### setPairs

          public final void setPairs(Collection<? extends AbstractLookup.Pair> c)

      Changes all pairs in the lookup to new values.
      Parameters:
        `c` - the collection of (Pair) objects

Copyright © 2025 API Design. All Rights Reserved.