@SuppressWarnings("unchecked") public JobInfo build(Object data) { if (null == data) { return null; } List<byte[]> showRaw = (List<byte[]>) data; return new JobInfo(SafeEncoder.encode(showRaw.get(1)), SafeEncoder.encode(showRaw.get(3)), SafeEncoder.encode(showRaw.get(5)), BuilderFactory.LONG.build(showRaw.get(7)), BuilderFactory.LONG.build(showRaw.get(9)), BuilderFactory.LONG.build(showRaw.get(11)), BuilderFactory.LONG.build(showRaw.get(13)), BuilderFactory.LONG.build(showRaw.get(15)), BuilderFactory.STRING_LIST.build(showRaw.get(17)), BuilderFactory.STRING_LIST.build(showRaw.get(19)), BuilderFactory.LONG.build(showRaw.get(21)), BuilderFactory.LONG.build(showRaw.get(23)), SafeEncoder.encode(showRaw.get(25))); }
@Override public Response<Long> hincrBy(String key, String field, long value) { Action<Long> action = new Action<>( BuilderFactory.LONG, getMethod("hincrBy", String.class, String.class, long.class), key, field, value ); this.actions.add(action); return action.response; }
@Override public Response<Long> del(String... keys) { Action<Long> action = new Action<>( BuilderFactory.LONG, getMethod("del", String[].class), keys ); this.actions.add(action); return action.response; }
@Override public Response<Long> del(String key) { Action<Long> action = new Action<>( BuilderFactory.LONG, getMethod("del", String.class), key ); this.actions.add(action); return action.response; }
@Override public Response<String> set(String key, String value) { Action<String> action = new Action<>( BuilderFactory.STRING, getMethod("set", String.class, String.class), key, value ); this.actions.add(action); return action.response; }
@Override public Response<String> lpop(String key) { Action<String> action = new Action<>( BuilderFactory.STRING, getMethod("lpop", String.class), key ); this.actions.add(action); return action.response; }
@Override public Response<Long> lpush(String key, String... string) { Action<Long> action = new Action<>( BuilderFactory.LONG, getMethod("lpush", String.class, String[].class), key, string ); this.actions.add(action); return action.response; }
@Test public void buildDouble() { Double build = BuilderFactory.DOUBLE.build("1.0".getBytes()); assertEquals(new Double(1.0), build); }