org.catnut.support.TransientUser.java Source code

Java tutorial

Introduction

Here is the source code for org.catnut.support.TransientUser.java

Source

/*
 * The MIT License (MIT)
 * Copyright (c) 2014 longkai
 * The software shall be used for good, not evil.
 */
package org.catnut.support;

import android.util.Log;
import org.catnut.metadata.User;
import org.catnut.util.Constants;
import org.json.JSONObject;

/**
 * ????,etc. ??Orz
 * <p/>
 * ???
 *
 * @author longkai
 */
public class TransientUser {

    public long id;
    public String screenName;
    public String location;
    public String description;
    public boolean verified;
    public String avatarUrl;

    public static TransientUser convert(JSONObject jsonObject) {
        TransientUser user = new TransientUser();
        user.id = jsonObject.optLong(Constants.ID);
        user.screenName = jsonObject.optString(User.screen_name);
        user.location = jsonObject.optString(User.location);
        user.description = jsonObject.optString(User.description);
        user.verified = jsonObject.optBoolean(User.verified);
        user.avatarUrl = jsonObject.optString(User.profile_image_url);
        return user;
    }
}