Back to project page ReadabilitySDK.
The source code is released under:
MIT License
If you think the Android project ReadabilitySDK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.idemidov.readability.parser; // www . j av a 2 s . c o m import com.idemidov.readability.data.Bookmark; import com.idemidov.readability.data.CommandResponse; import com.idemidov.readability.util.ResultCode; import org.json.JSONException; import org.json.JSONObject; public class GetBookmarkByIdParser implements Parser<Bookmark> { @Override public CommandResponse<Bookmark> parse(String response) throws JSONException { CommandResponse<Bookmark> result = new CommandResponse<Bookmark>(); result.setData(parseBookmark(new JSONObject(response))); result.setCode(ResultCode.CODE_OK); return result; } public static Bookmark parseBookmark(JSONObject jsonBookmark) throws JSONException { Bookmark bookmark = new Bookmark(); bookmark.setUserId(jsonBookmark.optInt("user_id")); bookmark.setReadPercent(jsonBookmark.optDouble("read_percent")); bookmark.setDateUpdated(jsonBookmark.optString("date_updated")); bookmark.setFavorite(jsonBookmark.optBoolean("favorite")); bookmark.setId(jsonBookmark.optInt("id")); bookmark.setDateArchived(jsonBookmark.optString("date_archived")); bookmark.setDateAdded(jsonBookmark.optString("date_added")); bookmark.setArticleHref(jsonBookmark.optString("article_href")); bookmark.setDateFavorited(jsonBookmark.optString("date_favorited")); bookmark.setArticle(GetArticleByIdParser.parseArticle(jsonBookmark.optJSONObject("article"))); bookmark.setTags(GetTagsParser.parseTags(jsonBookmark.optJSONArray("tags"))); return bookmark; } }