private void init(JSONObject json) throws FacebookException {
try {
id = getRawString("id", json);
if (!json.isNull("from")) {
JSONObject fromJSONObject = json.getJSONObject("from");
from = new CategoryJSONImpl(fromJSONObject);
}
name = getRawString("name", json);
description = getRawString("description", json);
location = getRawString("location", json);
link = getURL("link", json);
coverPhoto = getRawString("cover_photo", json);
privacy = PrivacyType.getInstance(getRawString("privacy", json));
count = getInt("count", json);
type = getRawString("type", json);
createdTime = getISO8601Datetime("created_time", json);
updatedTime = getISO8601Datetime("updated_time", json);
canUpload = getBoolean("can_upload", json);
if (!json.isNull("place")) {
JSONObject placeJSONObject = json.getJSONObject("place");
place = new PlaceJSONImpl(placeJSONObject);
}
if (!json.isNull("likes")) {
JSONObject likesJSONObject = json.getJSONObject("likes");
if (!likesJSONObject.isNull("data")) {
JSONArray list = likesJSONObject.getJSONArray("data");
final int size = list.length();
likes = new PagableListImpl<Like>(size, likesJSONObject);
for (int i = 0; i < size; i++) {
LikeJSONImpl like = new LikeJSONImpl(list.getJSONObject(i));
likes.add(like);
}
} else {
likes = new PagableListImpl<Like>(1, likesJSONObject);
}
} else {
likes = new PagableListImpl<Like>(0);
}
if (!json.isNull("comments")) {
JSONObject commentsJSONObject = json.getJSONObject("comments");
if (!commentsJSONObject.isNull("data")) {
JSONArray list = commentsJSONObject.getJSONArray("data");
final int size = list.length();
comments = new PagableListImpl<Comment>(size, commentsJSONObject);
for (int i = 0; i < size; i++) {
CommentJSONImpl comment = new CommentJSONImpl(list.getJSONObject(i));
comments.add(comment);