Class PluginsContainer.PluginsSpliterator<T>

java.lang.Object
java.util.Spliterators.AbstractSpliterator<T>
aQute.bnd.osgi.PluginsContainer.PluginsSpliterator<T>
All Implemented Interfaces:
Consumer<Object>, Spliterator<T>
Enclosing class:
PluginsContainer

final class PluginsContainer.PluginsSpliterator<T> extends Spliterators.AbstractSpliterator<T> implements Consumer<Object>
A spliterator of plugins of the specified type ordered by the processor hierarchy.

The supplied plugins may have duplicates if the same plugin is added into different processors in the hierarchy.

We supply the parent's plugins after this container's plugins so that there is a hierarchical ordering where this container's plugins come before the parent's plugins. Then PluginsContainer.getPlugin(Class) will select a matching plugin from this container, if it exists, versus one from the parent.

  • Field Details

  • Constructor Details

    • PluginsSpliterator

      PluginsSpliterator(Class<T> type)
  • Method Details

    • parent

      private Spliterator<T> parent()
      Defer creating the parent spliterator since we may not need it if the stream operation short circuits such as findFirst.
    • tryAdvance

      public boolean tryAdvance(Consumer<? super T> action)
      Specified by:
      tryAdvance in interface Spliterator<T>
    • forEachRemaining

      public void forEachRemaining(Consumer<? super T> action)
      Specified by:
      forEachRemaining in interface Spliterator<T>
    • accept

      public void accept(Object plugin)
      Specified by:
      accept in interface Consumer<T>