出于某种原因,在Robospice中从缓存中拉回缓存对象始终为null。有什么我做错了吗?
getSpiceManager().execute(cardRequest, Card.class.getName(),
DurationInMillis.ONE_DAY, new CardRequestListener());
它是如何执行的。 spice管理器创建如下:
mSpiceManager = new SpiceManager(JacksonGoogleHttpClientSpiceService.class);
卡片类如下:
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"iosThumbHighRes",
"iosThumb",
"iosLargeHiRes",
"iosLargeHighRes",
"iosLarge"
})
public class Card {
@JsonProperty("iosThumbHighRes")
private String iosThumbHighRes;
@JsonProperty("iosThumb")
private String iosThumb;
@JsonProperty("iosLargeHiRes")
private String iosLargeHiRes;
@JsonProperty("iosLargeHighRes")
private String iosLargeHighRes;
@JsonProperty("iosLarge")
private String iosLarge;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("iosThumbHighRes")
public String getIosThumbHighRes() {
return iosThumbHighRes;
}
@JsonProperty("iosThumbHighRes")
public void setIosThumbHighRes(String iosThumbHighRes) {
this.iosThumbHighRes = iosThumbHighRes;
}
@JsonProperty("iosThumb")
public String getIosThumb() {
return iosThumb;
}
@JsonProperty("iosThumb")
public void setIosThumb(String iosThumb) {
this.iosThumb = iosThumb;
}
@JsonProperty("iosLargeHiRes")
public String getIosLargeHiRes() {
return iosLargeHiRes;
}
@JsonProperty("iosLargeHiRes")
public void setIosLargeHiRes(String iosLargeHiRes) {
this.iosLargeHiRes = iosLargeHiRes;
}
@JsonProperty("iosLargeHighRes")
public String getIosLargeHighRes() {
return iosLargeHighRes;
}
@JsonProperty("iosLargeHighRes")
public void setIosLargeHighRes(String iosLargeHighRes) {
this.iosLargeHighRes = iosLargeHighRes;
}
@JsonProperty("iosLarge")
public String getIosLarge() {
return iosLarge;
}
@JsonProperty("iosLarge")
public void setIosLarge(String iosLarge) {
this.iosLarge = iosLarge;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
@Override
public boolean equals(Object other) {
return EqualsBuilder.reflectionEquals(this, other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperties(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
我还需要设置其他内容吗?
谢谢,Graeme
答案 0 :(得分:2)
Google Http客户端使用@Key注释。您正在使用Googe Http Java Client不支持的Jackson注释,因为它为所有序列化解决方案提供了一个抽象层(gson / jackson)。