Class MutableInstanceContent

java.lang.Object
org.openide.util.lookup.AbstractLookup.Content
org.jjazz.utilities.api.MutableInstanceContent
All Implemented Interfaces:
Serializable

public class MutableInstanceContent extends org.openide.util.lookup.AbstractLookup.Content
A special InstanceContent directly copied from the original source code (NB7), but which uses MutableInstanceContent internally to allow handling of mutable objects. Note that the equals() and hashCode() functions of the stored objects will no longer be used.

With the default InstanceContent implementation, this does not work, when stored objects are modified, objects removing may fail because their hashCode() has changed.

Note that operations that use Convertor are not supported.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new, empty content.
    Creates a content associated with an executor to handle dispatch of changes.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(Object inst)
    The method to add instance to the lookup with.
    final <T, R> void
    add(T inst, org.openide.util.lookup.InstanceContent.Convertor<T,R> conv)
     
    final void
    remove(Object inst)
    Remove instance.
    final <T, R> void
    remove(T inst, org.openide.util.lookup.InstanceContent.Convertor<T,R> conv)
     
    final <T, R> void
    set(Collection<T> col, org.openide.util.lookup.InstanceContent.Convertor<T,R> conv)
     

    Methods inherited from class org.openide.util.lookup.AbstractLookup.Content

    addPair, removePair, setPairs

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MutableInstanceContent

      public MutableInstanceContent()
      Create a new, empty content.
    • MutableInstanceContent

      public MutableInstanceContent(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 Details

    • add

      public final void add(Object inst)
      The method to add instance to the lookup with.
      Parameters:
      inst - instance
    • add

      public final <T, R> void add(T inst, org.openide.util.lookup.InstanceContent.Convertor<T,R> conv)
    • remove

      public final void remove(Object inst)
      Remove instance.
      Parameters:
      inst - instance
    • remove

      public final <T, R> void remove(T inst, org.openide.util.lookup.InstanceContent.Convertor<T,R> conv)
    • set

      public final <T, R> void set(Collection<T> col, org.openide.util.lookup.InstanceContent.Convertor<T,R> conv)