2

由于某种原因,从 Robospice 的缓存中拉回缓存的对象始终为空。有什么我做错了吗?

getSpiceManager().execute(cardRequest, Card.class.getName(),  
                           DurationInMillis.ONE_DAY, new CardRequestListener());

是如何执行的。香料管理器的创建如下:

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);
    }

}

还有什么我需要设置的吗?

谢谢,格雷姆

4

1 回答 1

2

Google Http 客户端使用@Key 注释。您正在使用 Googe Http Java Client 不支持的 Jackson 注释,因为它为所有序列化解决方案(gson/jackson)提供了一个抽象层。

于 2014-01-03T14:59:49.787 回答