T - the concrete Plugin interfaceS - the delimiter typepublic interface PluginRegistry<T extends Plugin<S>,S> extends Iterable<T>
Plugins. Allows sophisticated typesafe access to implementations of interfaces extending {link
Plugin}.| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(T plugin)
Returns whether the registry contains a given plugin.
|
int |
countPlugins()
Returns the number of registered plugins.
|
static <S,T extends Plugin<S>> |
empty()
Creates a new
PluginRegistry using the #DEFAULT_COMPARATOR. |
Optional<T> |
getPluginFor(S delimiter)
Returns the first
Plugin found for the given delimiter. |
<E extends Exception> |
getPluginFor(S delimiter,
Supplier<E> ex)
Retrieves a required plugin from the registry or throw the given exception if none can be found.
|
T |
getPluginOrDefaultFor(S delimiter,
Supplier<T> defaultSupplier)
Returns the first
Plugin supporting the given delimiter or the given lazily-provided plugin if none can be
found. |
T |
getPluginOrDefaultFor(S delimiter,
T plugin)
Returns the first
Plugin supporting the given delimiter or the given plugin if none can be found. |
List<T> |
getPlugins()
Returns all
Plugins contained in this registry. |
List<T> |
getPluginsFor(S delimiter)
Returns all plugins for the given delimiter.
|
List<T> |
getPluginsFor(S delimiter,
List<? extends T> plugins)
Returns all
Plugins supporting the given delimiter or the given plugins if none found. |
<E extends Exception> |
getPluginsFor(S delimiter,
Supplier<E> ex)
Retrieves all plugins for the given delimiter or throws an exception if no plugin can be found.
|
T |
getRequiredPluginFor(S delimiter)
Returns the first
Plugin found for the given delimiter. |
T |
getRequiredPluginFor(S delimiter,
Supplier<String> message)
Returns the first
Plugin found for the given delimiter. |
boolean |
hasPluginFor(S delimiter)
Returns whether the registry contains a
Plugin matching the given delimiter. |
static <S,T extends Plugin<S>> |
of(Comparator<? super T> comparator)
|
static <S,T extends Plugin<S>> |
of(List<? extends T> plugins)
Creates a new
OrderAwarePluginRegistry with the given plugins. |
static <S,T extends Plugin<S>> |
of(List<? extends T> plugins,
Comparator<? super T> comparator)
Creates a new
OrderAwarePluginRegistry with the given plugins. |
static <S,T extends Plugin<S>> |
of(T... plugins)
Creates a new
PluginRegistry with the given plugins. |
forEach, iterator, spliteratorstatic <S,T extends Plugin<S>> PluginRegistry<T,S> empty()
PluginRegistry using the #DEFAULT_COMPARATOR.static <S,T extends Plugin<S>> PluginRegistry<T,S> of(Comparator<? super T> comparator)
comparator - must not be null.@SafeVarargs static <S,T extends Plugin<S>> PluginRegistry<T,S> of(T... plugins)
PluginRegistry with the given plugins.plugins - must not be null.static <S,T extends Plugin<S>> PluginRegistry<T,S> of(List<? extends T> plugins)
OrderAwarePluginRegistry with the given plugins.plugins - must not be null.static <S,T extends Plugin<S>> PluginRegistry<T,S> of(List<? extends T> plugins, Comparator<? super T> comparator)
OrderAwarePluginRegistry with the given plugins.plugins - Optional<T> getPluginFor(S delimiter)
Plugin found for the given delimiter. Thus, further configured Plugins are
ignored.delimiter - must not be null.Optional.empty() if none found.T getRequiredPluginFor(S delimiter) throws IllegalArgumentException
Plugin found for the given delimiter. Thus, further configured Plugins are
ignored.delimiter - must not be null.Plugin for the given originating system or Optional.empty() if none found.IllegalArgumentException - in case no Plugin for the given delimiterT getRequiredPluginFor(S delimiter, Supplier<String> message) throws IllegalArgumentException
Plugin found for the given delimiter. Thus, further configured Plugins are
ignored.delimiter - must not be null.message - a Supplier to produce an exception message in case no plugin is found.Plugin for the given originating system or Optional.empty() if none found.IllegalArgumentException - in case no Plugin for the given delimiterList<T> getPluginsFor(S delimiter)
delimiter - must not be null.<E extends Exception> T getPluginFor(S delimiter, Supplier<E> ex) throws E extends Exception
E - the exception type to be thrown in case no plugin can be found.delimiter - must not be null.ex - a lazy Supplier to produce an exception in case no plugin can be found, must not be
null.E - if no plugin can be found for the given delimiterE extends Exception<E extends Exception> List<T> getPluginsFor(S delimiter, Supplier<E> ex) throws E extends Exception
T getPluginOrDefaultFor(S delimiter, T plugin)
Plugin supporting the given delimiter or the given plugin if none can be found.T getPluginOrDefaultFor(S delimiter, Supplier<T> defaultSupplier)
Plugin supporting the given delimiter or the given lazily-provided plugin if none can be
found.List<T> getPluginsFor(S delimiter, List<? extends T> plugins)
Plugins supporting the given delimiter or the given plugins if none found.int countPlugins()
boolean contains(T plugin)
plugin - must not be null.boolean hasPluginFor(S delimiter)
Plugin matching the given delimiter.delimiter - must not be null.List<T> getPlugins()
Plugins contained in this registry. Will return an immutable List to prevent outside
modifications of the PluginRegistry content.Copyright © 2008–2019 Pivotal Software, Inc.. All rights reserved.