1

Google端點消息對象非常簡單的POJO。我有一個複合POJO曾經工作,但現在不再工作。我得到的錯誤,當android客戶端進行調用時,是因爲AnimalTag無法解析JSON。這是POJO。要遷移到Java 7,我手動複製並粘貼了代碼。所以我認爲這可能是事業的原因,也許我留下了一些東西。但我想不出會出現什麼問題。其他調用工作正常。但是這個一直在失敗。谷歌端點消息在更新到Java之後停止工作7

其用法是該方法從客戶端接收到Dog以保存在服務器上。並非Dog中的所有數據都已填充,但包括AnimalTag在內的許多數據都已填充。另外,AnimalTag只有製造商填補了。再次,這一切都用於工作。

public class Dog { 

    private String name; 
    private String owner; 
    private AnimalTag tag; 

    public Dog(String name, String owner, AnimalTag tag) { 
     super(); 
     this.name = name; 
     this.owner = owner; 
     this.tag = tag; 
    } 

    public String getName() { 
     return this.name; 
    } 
    public void setName(String name) { 
     this.name = name; 
    } 
    public String getOwner() { 
     return this.owner; 
    } 
    public void setOwner(String owner) { 
     this.owner = owner; 
    } 
    public AnimalTag getTag() { 
     return this.tag; 
    } 
    public void setTag(AnimalTag tag) { 
     this.tag = tag; 
    } 

} 


class AnimalTag{ 
    private long number; 
    BlobKey imageKey; 
    String manufacturer; 

    public AnimalTag(long number, BlobKey imageKey, String manufacturer) { 
     super(); 
     this.number = number; 
     this.imageKey = imageKey; 
     this.manufacturer = manufacturer; 
    } 

    public long getNumber() { 
     return this.number; 
    } 
    public void setNumber(long number) { 
     this.number = number; 
    } 
    public BlobKey getImageKey() { 
     return this.imageKey; 
    } 
    public void setImageKey(BlobKey imageKey) { 
     this.imageKey = imageKey; 
    } 
    public String getManufacturer() { 
     return this.manufacturer; 
    } 
    public void setManufacturer(String manufacturer) { 
     this.manufacturer = manufacturer; 
    } 
} 

回答

0

我得到了答案,AnimalTag失蹤下面的構造:

public AnimalTag(){} 
相關問題