Adjust ChannelPipeline to support method-chaining in a consistent way

This commit is contained in:
Norman Maurer 2012-12-14 17:06:31 +01:00
parent caa698f235
commit ba3c795fdf
2 changed files with 6 additions and 4 deletions

View File

@ -346,7 +346,7 @@ public interface ChannelPipeline extends ChannelInboundInvoker, ChannelOutboundI
* @throws NullPointerException
* if the specified handler is {@code null}
*/
void remove(ChannelHandler handler);
ChannelPipeline remove(ChannelHandler handler);
/**
* Removes the {@link ChannelHandler} with the specified name from this
@ -410,7 +410,7 @@ public interface ChannelPipeline extends ChannelInboundInvoker, ChannelOutboundI
* if the specified old handler, new name, or new handler is
* {@code null}
*/
void replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler);
ChannelPipeline replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler);
/**
* Replaces the {@link ChannelHandler} of the specified name with a new

View File

@ -341,8 +341,9 @@ public class DefaultChannelPipeline implements ChannelPipeline {
}
@Override
public void remove(ChannelHandler handler) {
public ChannelPipeline remove(ChannelHandler handler) {
remove(getContextOrDie(handler));
return this;
}
@Override
@ -478,8 +479,9 @@ public class DefaultChannelPipeline implements ChannelPipeline {
}
@Override
public void replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler) {
public ChannelPipeline replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler) {
replace(getContextOrDie(oldHandler), newName, newHandler);
return this;
}
@Override