pipeline return formatted values

This commit is contained in:
Jonathan Leibiusky
2011-04-06 01:07:20 -03:00
parent ff50c17238
commit 6707b62342
9 changed files with 729 additions and 726 deletions

View File

@@ -0,0 +1,31 @@
package redis.clients.jedis;
import redis.clients.jedis.exceptions.JedisDataException;
public class Response<T> {
protected T response = null;
private boolean built = false;
private Builder<T> builder;
public Response(Builder<T> b) {
this.builder = b;
}
public void set(Object data) {
response = builder.build(data);
built = true;
}
public T get() {
if (!built) {
throw new JedisDataException(
"Please close pipeline or multi block before calling this method.");
}
return response;
}
public String toString() {
return "Response " + builder.toString();
}
}