com.aliyun.tair.tairstring.factory.StringBuilderFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alibabacloud-tairjedis-sdk Show documentation
Show all versions of alibabacloud-tairjedis-sdk Show documentation
Aliyun Tair Redis client for Java
Copyright (C) Alibaba Cloud Computing
All rights reserved.
版权所有 (C)阿里云计算有限公司
http://www.aliyun.com
package com.aliyun.tair.tairstring.factory;
import com.aliyun.tair.tairstring.results.ExcasResult;
import com.aliyun.tair.tairstring.results.ExgetResult;
import com.aliyun.tair.tairstring.results.ExincrbyVersionResult;
import redis.clients.jedis.Builder;
import java.util.List;
public class StringBuilderFactory {
public static final Builder> EXGET_RESULT_STRING = new Builder>() {
@Override
public ExgetResult build(Object data) {
if (data == null) {
return null;
}
List l = (List) data;
if (l.size() == 3) {
// WITHFLAGS, Success: [value, version, flags]
return new ExgetResult((String)l.get(0), ((Number)l.get(1)).longValue(),
((Number)l.get(2)).longValue());
}
return new ExgetResult(new String((byte[]) l.get(0)),((Number) l.get(1)).longValue());
}
@Override
public String toString() {
return "ExgetResult";
}
};
public static final Builder> EXGET_RESULT_BYTE = new Builder>() {
@Override
@SuppressWarnings("unchecked")
public ExgetResult build(Object data) {
if (data == null) {
return null;
}
List l = (List) data;
if (l.size() == 3) {
// WITHFLAGS, Success: [value, version, flags]
return new ExgetResult((byte[])l.get(0), ((Number)l.get(1)).longValue(),
((Number)l.get(2)).longValue());
}
return new ExgetResult((byte[])l.get(0),((Number) l.get(1)).longValue());
}
@Override
public String toString() {
return "ExgetResult";
}
};
public static final Builder> EXCAS_RESULT_STRING = new Builder>() {
@Override
public ExcasResult build(Object data) {
if (data == null) {
return null;
}
List l = (List) data;
return new ExcasResult(new String((byte[])l.get(0)), new String((byte[]) l.get(1)),((Number) l.get(2)).longValue());
}
@Override
public String toString() {
return "ExcasResult";
}
};
public static final Builder> EXCAS_RESULT_BYTE = new Builder>() {
@Override
@SuppressWarnings("unchecked")
public ExcasResult build(Object data) {
if (data == null) {
return null;
}
List l = (List) data;
return new ExcasResult((byte[])l.get(0), (byte[])l.get(1), ((Number) l.get(2)).longValue());
}
@Override
public String toString() {
return "ExcasResult";
}
};
public static final Builder EXINCRBY_VERSION_RESULT_STRING = new Builder() {
@Override
public ExincrbyVersionResult build(Object data) {
if (data == null) {
return null;
}
List l = (List) data;
return new ExincrbyVersionResult(((Number) l.get(0)).longValue(),((Number) l.get(1)).longValue());
}
@Override
public String toString() {
return "ExincrbyVersionResult";
}
};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy