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; //from w w w. j ava 2 s . c o m import com.idemidov.readability.data.CommandResponse; import com.idemidov.readability.data.User; import com.idemidov.readability.util.ResultCode; import org.json.JSONException; import org.json.JSONObject; /** * Created by Ilya on 26/02/14. */ public class GetUserCurrentParser implements Parser<User> { @Override public CommandResponse<User> parse(String response) throws JSONException { User user = new User(); JSONObject json = new JSONObject(response); user.setUserName(json.optString("username")); user.setFirstName(json.optString("first_name")); user.setLastName(json.optString("last_name")); user.setHasActiveSubscription(json.optBoolean("has_active_subscription")); user.setPublisher(json.optBoolean("is_publisher")); user.setEmailIntoAddress(json.optString("email_into_address")); user.setKindleEmailAddress(json.optString("kindle_email_address")); user.setAvatarUrl(json.optString("avatar_url")); user.setDateJoined(json.optString("date_joined")); user.setTags(GetTagsParser.parseTags(json.optJSONArray("tags"))); CommandResponse<User> result = new CommandResponse<User>(); result.setCode(ResultCode.CODE_OK); result.setData(user); return result; } }