private void init(JSONObject json) throws FacebookException {
try {
id = getRawString("id", json);
if (!json.isNull("from")) {
JSONObject fromJSONObject = json.getJSONObject("from");
from = new IdNameEntityJSONImpl(fromJSONObject);
}
if (!json.isNull("to")) {
JSONObject toJSONObject = json.getJSONObject("to");
JSONArray toJSONArray = toJSONObject.getJSONArray("data");
to = new ArrayList<IdNameEntity>();
for (int i = 0; i < toJSONArray.length(); i++) {
to.add(new IdNameEntityJSONImpl(toJSONArray.getJSONObject(i)));
}
} else {
to = Collections.emptyList();
}
message = getRawString("message", json);
createdTime = getISO8601Datetime("created_time", json);
updatedTime = getISO8601Datetime("updated_time", json);
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);