@Test public void testEncode2() throws Exception { Object o = new Object(); JsonDecoder jsonDecoder = new JsonDecoder(SwallowMessage.class); Assert.assertEquals(o, jsonDecoder.decode(null, null, o)); }
@SuppressWarnings("unchecked") @Override protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof ChannelBuffer)) { return msg; } ChannelBuffer buf = (ChannelBuffer) msg; String json = buf.toString(Charset.forName("UTF-8")); JsonBinder jsonBinder = JsonBinder.getNonEmptyBinder(); return jsonBinder.fromJson(json, clazz); }
JsonDecoder extends OneToOneDecoder { @SuppressWarnings("unchecked") @Override protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof ChannelBuffer)) { return msg; } ChannelBuffer buf = (ChannelBuffer) msg; String json = buf.toString(Charset.forName("UTF-8")); JsonBinder jsonBinder = JsonBinder.getNonEmptyBinder(); return jsonBinder.fromJson(json, clazz); } }
JsonDecoder extends OneToOneDecoder { @SuppressWarnings("unchecked") @Override protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof ChannelBuffer)) { return msg; } ChannelBuffer buf = (ChannelBuffer) msg; String json = buf.toString(Charset.forName("UTF-8")); JsonBinder jsonBinder = JsonBinder.getNonEmptyBinder(); return jsonBinder.fromJson(json, clazz); } JsonDecoder(Class clazz); }
JsonDecoder extends OneToOneDecoder { @SuppressWarnings("unchecked") @Override protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof ChannelBuffer)) { return msg; } ChannelBuffer buf = (ChannelBuffer) msg; String json = buf.toString(Charset.forName("UTF-8")); JsonBinder jsonBinder = JsonBinder.getNonEmptyBinder(); return jsonBinder.fromJson(json, clazz); } JsonDecoder(Class clazz);  }
JsonDecoder extends OneToOneDecoder { @SuppressWarnings("unchecked") @Override protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof ChannelBuffer)) { return msg; } ChannelBuffer buf = (ChannelBuffer) msg; String json = buf.toString(Charset.forName("UTF-8")); JsonBinder jsonBinder = JsonBinder.getNonEmptyBinder(); return jsonBinder.fromJson(json, clazz); } JsonDecoder(Class clazz);   }