Class IdentityBasedInstanceContent

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

public class IdentityBasedInstanceContent extends org.openide.util.lookup.AbstractLookup.Content
A drop-in replacement for InstanceContent that uses object identity (System.identityHashCode / ==) instead of the object's own hashCode/equals.

This avoids bug https://github.com/apache/netbeans/issues/9270/

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 Object

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

    • IdentityBasedInstanceContent

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

      public IdentityBasedInstanceContent(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)