Author: simonetripodi Date: Fri Aug 24 13:39:40 2012 New Revision: 1376910 URL: http://svn.apache.org/viewvc?rev=1376910&view=rev Log: both Filter/Chain extend Command interface - no need to overload the add() method - as shown in the Chain interface where Filter is not explicitly specified
Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/Chains.java commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/CommandSetter.java commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/NamedCommandSetter.java Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/Chains.java URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/Chains.java?rev=1376910&r1=1376909&r2=1376910&view=diff ============================================================================== --- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/Chains.java (original) +++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/Chains.java Fri Aug 24 13:39:40 2012 @@ -76,12 +76,6 @@ public final class Chains { return new DefaultChainExecutor<K, V, C>(chain); } - @Override - public <F extends Filter<K, V, C>> ChainExecutor<K, V, C> add(F filter) { - chain.addCommand(checkNotNullArgument(filter, "Chain does not accept null Filter instances")); - return new DefaultChainExecutor<K, V, C>(chain); - } - } private static final class DefaultChainExecutor<K, V, C extends Map<K, V>> implements ChainExecutor<K, V, C> { @@ -97,12 +91,6 @@ public final class Chains { return this; } - @Override - public <F extends Filter<K, V, C>> ChainExecutor<K, V, C> add(F filter) { - chain.addCommand(checkNotNullArgument(filter, "Chain does not accept null Filter instances")); - return this; - } - public boolean execute(C context) { return chain.execute(checkNotNullArgument(context, "Chain cannot be applied to a null context.")); } @@ -123,18 +111,6 @@ public final class Chains { return new DefaultNameSetter<K, V, C>(catalog, checkedCommand); } - @Override - public <F extends Filter<K, V, C>> NameSetter<K, V, C> add(F filter) { - F checkedFilter = checkNotNullArgument(filter, "Catalog does not accept null Filter instances"); - return new DefaultNameSetter<K, V, C>(catalog, checkedFilter); - } - - @Override - public <CH extends Chain<K, V, C>> NameSetter<K, V, C> add(CH chain) { - CH checkedChain = checkNotNullArgument(chain, "Catalog does not accept null Chain instances"); - return new DefaultNameSetter<K, V, C>(catalog, checkedChain); - } - } private static final class DefaultNameSetter<K, V, C extends Map<K, V>> implements NameSetter<K, V, C> { Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/CommandSetter.java URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/CommandSetter.java?rev=1376910&r1=1376909&r2=1376910&view=diff ============================================================================== --- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/CommandSetter.java (original) +++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/CommandSetter.java Fri Aug 24 13:39:40 2012 @@ -40,14 +40,4 @@ public interface CommandSetter<K, V, C e */ <CMD extends Command<K, V, C>> R add(CMD command); - /** - * Add the given filter to the target {@link Chain} has to be executed. - * - * @param <F> Type of the filter has to be added - * @param filter the filter has to be added in the target chain - * @return next chain builder - * @see Chain#addCommand(Command) - */ - <F extends Filter<K, V, C>> R add(F filter); - } Modified: commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/NamedCommandSetter.java URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/NamedCommandSetter.java?rev=1376910&r1=1376909&r2=1376910&view=diff ============================================================================== --- commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/NamedCommandSetter.java (original) +++ commons/proper/chain/trunk/core/src/main/java/org/apache/commons/chain2/NamedCommandSetter.java Fri Aug 24 13:39:40 2012 @@ -30,14 +30,4 @@ import java.util.Map; public interface NamedCommandSetter<K, V, C extends Map<K, V>> extends CommandSetter<K, V, C, NameSetter<K, V, C>> { - /** - * Add the given chain to the target {@link Chain} has to be added in the catalog. - * - * @param <CH> Type of the chain has to be added - * @param chain the chain has to be added in the target catalog - * @return next catalog builder - * @see Catalog#addCommand(String, Command) - */ - <CH extends Chain<K, V, C>> NameSetter<K, V, C> add(CH chain); - }