Let ChannelPipeline implement Iterable

This commit is contained in:
Norman Maurer 2013-02-08 07:10:46 +01:00
parent e5616c85c4
commit 32e0b59761
2 changed files with 9 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
@ -177,7 +178,8 @@ import java.util.NoSuchElementException;
* @apiviz.composedOf io.netty.channel.ChannelHandlerContext * @apiviz.composedOf io.netty.channel.ChannelHandlerContext
* @apiviz.owns io.netty.channel.ChannelHandler * @apiviz.owns io.netty.channel.ChannelHandler
*/ */
public interface ChannelPipeline extends ChannelInboundInvoker, ChannelOutboundInvoker { public interface ChannelPipeline extends ChannelInboundInvoker, ChannelOutboundInvoker,
Iterable<Entry<String, ChannelHandler>> {
/** /**
* Return the bound {@link MessageBuf} of the first {@link ChannelInboundMessageHandler} in the * Return the bound {@link MessageBuf} of the first {@link ChannelInboundMessageHandler} in the

View File

@ -28,6 +28,7 @@ import java.net.SocketAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -1322,4 +1323,9 @@ final class DefaultChannelPipeline implements ChannelPipeline {
unsafe.flush(promise); unsafe.flush(promise);
} }
} }
@Override
public Iterator<Map.Entry<String, ChannelHandler>> iterator() {
return toMap().entrySet().iterator();
}
} }