1
0
mirror of https://github.com/etesync/android synced 2025-06-23 16:38:51 +00:00

Collection info: serialize url, but not to json.

This commit is contained in:
Tom Hacohen 2017-03-08 14:40:12 +00:00
parent c6fbecc0ff
commit 4a196102a1

View File

@ -10,34 +10,44 @@ package com.etesync.syncadapter.model;
import android.content.ContentValues; import android.content.ContentValues;
import com.etesync.syncadapter.model.ServiceDB.Collections;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import java.io.Serializable; import java.io.Serializable;
import com.etesync.syncadapter.GsonHelper;
import com.etesync.syncadapter.model.ServiceDB.Collections;
import lombok.ToString; import lombok.ToString;
@ToString @ToString
public class CollectionInfo implements Serializable { public class CollectionInfo implements Serializable {
public transient long id; public long id;
public transient Long serviceID; public Long serviceID;
public enum Type { public enum Type {
ADDRESS_BOOK, ADDRESS_BOOK,
CALENDAR CALENDAR
} }
@Expose
public Type type; public Type type;
public transient String url; // Essentially the uuid public String url; // Essentially the uuid
@Expose
public boolean readOnly; public boolean readOnly;
@Expose
public String displayName, description; public String displayName, description;
@Expose
public Integer color; public Integer color;
@Expose
public String timeZone; public String timeZone;
@Expose
public Boolean supportsVEVENT; public Boolean supportsVEVENT;
@Expose
public Boolean supportsVTODO; public Boolean supportsVTODO;
@Expose
public boolean selected; public boolean selected;
public CollectionInfo() { public CollectionInfo() {
@ -104,11 +114,11 @@ public class CollectionInfo implements Serializable {
} }
public static CollectionInfo fromJson(String json) { public static CollectionInfo fromJson(String json) {
return GsonHelper.gson.fromJson(json, CollectionInfo.class); return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(json, CollectionInfo.class);
} }
public String toJson() { public String toJson() {
return GsonHelper.gson.toJson(this, CollectionInfo.class); return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().toJson(this, CollectionInfo.class);
} }
private static Boolean getAsBooleanOrNull(ContentValues values, String field) { private static Boolean getAsBooleanOrNull(ContentValues values, String field) {