@Override public void fromJson(JsonObject json) { this.creationTime = json.getLong("creationTime", -1L); int status = json.getInt("status", WanSyncStatus.READY.getStatus()); this.status = WanSyncStatus.getByStatus(status); this.syncedPartitionCount = json.getInt("syncedPartitionCount", 0); this.activeWanConfigName = json.getString("activeWanConfigName", null); this.activePublisherName = json.getString("activePublisherName", null); }
@Override public JsonObject toJson() { JsonObject root = new JsonObject(); root.add("creationTime", creationTime); root.add("status", status.getStatus()); root.add("syncedPartitionCount", syncedPartitionCount); if (activeWanConfigName != null) { root.add("activeWanConfigName", activeWanConfigName); } if (activePublisherName != null) { root.add("activePublisherName", activePublisherName); } return root; }