@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
|
||||
* orders {@link Plugin}s by regarding {@link org.springframework.core.Ordered} interface or
|
||||
* {@link org.springframework.core.annotation.Order} annotation. To alter ordering behaviour use one of the factory
|
||||
* methods accepting a {@link Comparator} as parameter.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePluginRegistry<T, S> {
|
||||
@@ -49,7 +49,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
|
||||
/**
|
||||
* Creates a new {@link OrderAwarePluginRegistry} with the given {@link Plugin}s and {@link Comparator}.
|
||||
*
|
||||
*
|
||||
* @param plugins the {@link Plugin}s to be contained in the registry or {@literal null} if the registry shall be
|
||||
* empty initally.
|
||||
* @param comparator the {@link Comparator} to be used for ordering the {@link Plugin}s or {@literal null} if the
|
||||
@@ -66,7 +66,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
|
||||
/**
|
||||
* Creates a new {@link OrderAwarePluginRegistry} using the {@code #DEFAULT_COMPARATOR}.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @since 2.0
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
/**
|
||||
* Creates a new {@link OrderAwarePluginRegistry} using the given {@link Comparator} for ordering contained
|
||||
* {@link Plugin}s.
|
||||
*
|
||||
*
|
||||
* @param comparator must not be {@literal null}.
|
||||
* @return
|
||||
* @since 2.0
|
||||
@@ -91,6 +91,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
|
||||
/**
|
||||
* Creates a new {@link OrderAwarePluginRegistry} with the given plugins.
|
||||
*
|
||||
* @param plugins must not be {@literal null}.
|
||||
* @return
|
||||
* @since 2.0
|
||||
@@ -114,7 +115,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
/**
|
||||
* Creates a new {@link OrderAwarePluginRegistry} with the given {@link Plugin}s and the order of the {@link Plugin}s
|
||||
* reverted.
|
||||
*
|
||||
*
|
||||
* @param plugins must not be {@literal null}.
|
||||
* @return
|
||||
* @since 2.0
|
||||
@@ -125,7 +126,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
|
||||
/**
|
||||
* Creates a new {@link OrderAwarePluginRegistry} with the given plugins.
|
||||
*
|
||||
*
|
||||
* @param plugins
|
||||
* @return
|
||||
* @since 2.0
|
||||
@@ -219,7 +220,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
|
||||
|
||||
/**
|
||||
* Returns a new {@link OrderAwarePluginRegistry} with the order of the plugins reverted.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public OrderAwarePluginRegistry<T, S> reverse() {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Registry for {@link Plugin}s. Allows sophisticated typesafe access to implementations of interfaces extending {link
|
||||
* Plugin}.
|
||||
*
|
||||
*
|
||||
* @param <T> the concrete {@link Plugin} interface
|
||||
* @param <S> the delimiter type
|
||||
* @author Oliver Gierke
|
||||
@@ -100,7 +100,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
/**
|
||||
* Returns the first {@link Plugin} found for the given delimiter. Thus, further configured {@link Plugin}s are
|
||||
* ignored.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @return a plugin for the given delimiter or {@link Optional#empty()} if none found.
|
||||
*/
|
||||
@@ -109,7 +109,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
/**
|
||||
* Returns the first {@link Plugin} found for the given delimiter. Thus, further configured {@link Plugin}s are
|
||||
* ignored.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @return a {@link Plugin} for the given originating system or {@link Optional#empty()} if none found.
|
||||
* @throws IllegalArgumentException in case no {@link Plugin} for the given delimiter
|
||||
@@ -119,7 +119,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
/**
|
||||
* Returns the first {@link Plugin} found for the given delimiter. Thus, further configured {@link Plugin}s are
|
||||
* ignored.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @param message a {@link Supplier} to produce an exception message in case no plugin is found.
|
||||
* @return a {@link Plugin} for the given originating system or {@link Optional#empty()} if none found.
|
||||
@@ -129,7 +129,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
|
||||
/**
|
||||
* Returns all plugins for the given delimiter.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @return a list of plugins or an empty list if none found
|
||||
*/
|
||||
@@ -138,7 +138,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
/**
|
||||
* Retrieves a required plugin from the registry or throw the given exception if none can be found. If more than one
|
||||
* plugins are found the first one will be returned.
|
||||
*
|
||||
*
|
||||
* @param <E> the exception type to be thrown in case no plugin can be found.
|
||||
* @param delimiter
|
||||
* @param ex a lazy {@link Supplier} to produce an exception in case no plugin can be found.
|
||||
@@ -149,7 +149,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
|
||||
/**
|
||||
* Retrieves all plugins for the given delimiter or throws an exception if no plugin can be found.
|
||||
*
|
||||
*
|
||||
* @param <E> the exception type to be thrown.
|
||||
* @param delimiter
|
||||
* @param ex a lazy {@link Supplier} to produce an exception in case no plugin can be found.
|
||||
@@ -160,7 +160,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
|
||||
/**
|
||||
* Returns the first {@link Plugin} supporting the given delimiter or the given plugin if none can be found.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @param plugin
|
||||
* @return a single {@link Plugin} supporting the given delimiter or the given {@link Plugin} if none found
|
||||
@@ -170,7 +170,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
/**
|
||||
* Returns the first {@link Plugin} supporting the given delimiter or the given lazily-provided plugin if none can be
|
||||
* found.
|
||||
*
|
||||
*
|
||||
* @param delimiter can be {@literal null}.
|
||||
* @param defaultSupplier must not be {@literal null}.
|
||||
* @return a single {@link Plugin} supporting the given delimiter or the given lazily provided {@link Plugin} if none
|
||||
@@ -180,7 +180,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
|
||||
/**
|
||||
* Returns all {@link Plugin}s supporting the given delimiter or the given plugins if none found.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @param plugins
|
||||
* @return all {@link Plugin}s supporting the given delimiter or the given {@link Plugin}s if none found
|
||||
@@ -189,14 +189,14 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
|
||||
/**
|
||||
* Returns the number of registered plugins.
|
||||
*
|
||||
*
|
||||
* @return the number of plugins in the registry
|
||||
*/
|
||||
int countPlugins();
|
||||
|
||||
/**
|
||||
* Returns whether the registry contains a given plugin.
|
||||
*
|
||||
*
|
||||
* @param plugin
|
||||
* @return
|
||||
*/
|
||||
@@ -204,7 +204,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
|
||||
/**
|
||||
* Returns whether the registry contains a {@link Plugin} matching the given delimiter.
|
||||
*
|
||||
*
|
||||
* @param delimiter
|
||||
* @return
|
||||
*/
|
||||
@@ -213,7 +213,7 @@ public interface PluginRegistry<T extends Plugin<S>, S> extends Iterable<T> {
|
||||
/**
|
||||
* Returns all {@link Plugin}s contained in this registry. Will return an immutable {@link List} to prevent outside
|
||||
* modifications of the {@link PluginRegistry} content.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<T> getPlugins();
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
/**
|
||||
* Unit test for {@link OrderAwarePluginRegistry} that especially concentrates on testing ordering functionality.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTest {
|
||||
@@ -126,7 +126,7 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.springframework.plugin.core.Plugin#supports(java.lang.Object)
|
||||
*/
|
||||
public boolean supports(String delimiter) {
|
||||
@@ -140,7 +140,7 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.springframework.plugin.core.Plugin#supports(java.lang.Object)
|
||||
*/
|
||||
public boolean supports(String delimiter) {
|
||||
|
||||
Reference in New Issue
Block a user