From 7678b1172f67c4f97c2079b136e8e4be243dbc75 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 11 Jan 2010 14:23:15 +0000 Subject: [PATCH] * refactored @addPlugin@ to be fluent interface style git-svn-id: svn+ssh://svn.synyx.de/var/svn/synyx/opensource/hera/trunk@8540 5a64d73e-33d6-4ccc-9058-23f8668ecac9 --- .../main/java/org/synyx/hera/core/MutablePluginRegistry.java | 2 +- .../java/org/synyx/hera/core/OrderAwarePluginRegistry.java | 3 ++- .../main/java/org/synyx/hera/core/SimplePluginRegistry.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/synyx/hera/core/MutablePluginRegistry.java b/core/src/main/java/org/synyx/hera/core/MutablePluginRegistry.java index 77b972c..2fc4b61 100644 --- a/core/src/main/java/org/synyx/hera/core/MutablePluginRegistry.java +++ b/core/src/main/java/org/synyx/hera/core/MutablePluginRegistry.java @@ -41,7 +41,7 @@ public interface MutablePluginRegistry, S> extends * * @param plugin */ - void addPlugin(T plugin); + MutablePluginRegistry addPlugin(T plugin); /** diff --git a/core/src/main/java/org/synyx/hera/core/OrderAwarePluginRegistry.java b/core/src/main/java/org/synyx/hera/core/OrderAwarePluginRegistry.java index a176647..5893856 100644 --- a/core/src/main/java/org/synyx/hera/core/OrderAwarePluginRegistry.java +++ b/core/src/main/java/org/synyx/hera/core/OrderAwarePluginRegistry.java @@ -170,10 +170,11 @@ public class OrderAwarePluginRegistry, S> extends * org.synyx.hera.core.PluginRegistry#addPlugin(org.synyx.hera.core.Plugin) */ @Override - public void addPlugin(T plugin) { + public OrderAwarePluginRegistry addPlugin(T plugin) { super.addPlugin(plugin); Collections.sort(getPlugins(), comparator); + return this; } diff --git a/core/src/main/java/org/synyx/hera/core/SimplePluginRegistry.java b/core/src/main/java/org/synyx/hera/core/SimplePluginRegistry.java index 9ce2741..3505601 100644 --- a/core/src/main/java/org/synyx/hera/core/SimplePluginRegistry.java +++ b/core/src/main/java/org/synyx/hera/core/SimplePluginRegistry.java @@ -96,9 +96,10 @@ public class SimplePluginRegistry, S> implements * org.synyx.hera.core.MutablePluginRegistry#addPlugin(org.synyx.hera.core * .Plugin) */ - public void addPlugin(T plugin) { + public SimplePluginRegistry addPlugin(T plugin) { this.plugins.add(plugin); + return this; }