@Test public void testAddDecoder() throws Exception { ChannelInboundHandler decoder = getDecoder(); HandlerFactory handler = HandlerFactory.instanceAddDecoder(decoder, HandlerFactory.Position.END); assertNotNull(handler); assertEquals(2, handler.getDecoders().length); assertNotEquals(decoder, handler.getDecoders()[0]); assertEquals(decoder, handler.getDecoders()[1]); decoder = getDecoder(); handler.addDecoder(decoder, HandlerFactory.Position.BEGIN); assertEquals(3, handler.getDecoders().length); assertNotEquals(decoder, handler.getDecoders()[0]); assertEquals(decoder, handler.getDecoders()[1]); assertNotEquals(decoder, handler.getDecoders()[2]); }
public synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos) { Preconditions.checkNotNull(decoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { decoders.addLast(decoder); } else { decoders.addFirst(decoder); } return this; }
HandlerFactory { public synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos) { Preconditions.checkNotNull(decoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { decoders.addLast(decoder); } else { decoders.addFirst(decoder); } return this; } }
HandlerFactory { public synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos) { Preconditions.checkNotNull(decoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { decoders.addLast(decoder); } else { decoders.addFirst(decoder); } return this; }  }
HandlerFactory { public synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos) { Preconditions.checkNotNull(decoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { decoders.addLast(decoder); } else { decoders.addFirst(decoder); } return this; }  static HandlerFactory instanceAddDecoder(ChannelInboundHandler decoder, Position pos); static HandlerFactory instanceAddEncoder(ChannelOutboundHandler encoder, Position pos); synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos); synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos); synchronized ChannelHandler[] getDecoders(); synchronized ChannelHandler[] getEncoders(); }
HandlerFactory { public synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos) { Preconditions.checkNotNull(decoder); Preconditions.checkNotNull(pos); if (Position.END.equals(pos)) { decoders.addLast(decoder); } else { decoders.addFirst(decoder); } return this; }  static HandlerFactory instanceAddDecoder(ChannelInboundHandler decoder, Position pos); static HandlerFactory instanceAddEncoder(ChannelOutboundHandler encoder, Position pos); synchronized HandlerFactory addDecoder(ChannelInboundHandler decoder, Position pos); synchronized HandlerFactory addEncoder(ChannelOutboundHandler encoder, Position pos); synchronized ChannelHandler[] getDecoders(); synchronized ChannelHandler[] getEncoders();  }