Class SimpleKeyedContainer<I,​T>

    • Method Detail

      • getJavaObject

        public T getJavaObject​(Object itemId)
        Description copied from class: AbstractSimpleContainer
        Get the underlying Java object corresponding to the given item ID. This method ignores any filtering (i.e., filtered-out objects are still accessible).
        Specified by:
        getJavaObject in class AbstractSimpleContainer<I,​T>
        Parameters:
        itemId - item ID
        Returns:
        the corresponding Java object, or null if not found
      • getItemIdFor

        public I getItemIdFor​(T obj)
        Get the container item ID corresponding to the given underlying Java object which is wrapped by this container. Objects are tested for equality using Object.equals().

        This method uses an internal hash map for efficiency, and assumes that two underlying container objects that are equal will have the same key.

        This method is not used by this class but is defined as a convenience for subclasses.

        Overrides:
        getItemIdFor in class AbstractSimpleContainer<I,​T>
        Parameters:
        obj - underlying container object
        Returns:
        item ID corresponding to object, or null if object is not found in this container
        Throws:
        IllegalArgumentException - if object is null
        See Also:
        getItemIdForSame(T)
      • getItemIdForSame

        public I getItemIdForSame​(T obj)
        Get the container item ID corresponding to the given underlying Java object which is wrapped by this container. Objects are tested for equality using object equality, not Object.equals().

        This method uses an internal hash map for efficiency.

        This method is not used by this class but is defined as a convenience for subclasses.

        Overrides:
        getItemIdForSame in class AbstractSimpleContainer<I,​T>
        Parameters:
        obj - underlying container object
        Returns:
        item ID corresponding to object, or null if object is not found in this container
        Throws:
        IllegalArgumentException - if object is null
        See Also:
        getItemIdFor(T)
      • generateItemId

        protected final I generateItemId​(T obj)
        Description copied from class: AbstractSimpleContainer
        Create a new, unique item ID for the given object. This method is invoked during a reload operation, once for each container object. Both visible and filtered objects will be passed to this method.

        The returned item ID must be unique, i.e., not returned by this method since the most recent invocation of AbstractSimpleContainer.resetItemIds().

        Specified by:
        generateItemId in class AbstractSimpleContainer<I,​T>
        Parameters:
        obj - underlying container object, never null
        Returns:
        item ID, never null
      • getKeyFor

        protected abstract I getKeyFor​(T obj)
        Get the key to be used as item ID for the given object. All objects in the container must have unique keys. This method must return the same key for the same object even if invoked multiple times.
        Parameters:
        obj - underlying container object
        Returns:
        key for object