当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.toString方法代码示例

本文整理汇总了Java中twitter4j.internal.org.json.JSONObject.toString方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.toString方法的具体用法?Java JSONObject.toString怎么用?Java JSONObject.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter4j.internal.org.json.JSONObject的用法示例。


在下文中一共展示了JSONObject.toString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    id = getLong("id", json);
    idStr = getRawString("id_str", json);
    name = getRawString("name", json);
    fullName = getRawString("full_name", json);
    slug = getRawString("slug", json);
    description = getRawString("description", json);
    subscriberCount = getInt("subscriber_count", json);
    memberCount = getInt("member_count", json);
    uri = getRawString("uri", json);
    mode = "public".equals(getRawString("mode", json));
    following = getBoolean("following", json);

    try {
        if (!json.isNull("user")) {
            user = new UserJSONImpl(json.getJSONObject("user"));
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:22,代码来源:UserListJSONImpl.java

示例2: FriendshipJSONImpl

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
FriendshipJSONImpl(JSONObject json) throws TwitterException {
    super();
    try {
        id = getLong("id", json);
        name = json.getString("name");
        screenName = json.getString("screen_name");
        JSONArray connections = json.getJSONArray("connections");
        for (int i = 0; i < connections.length(); i++) {
            String connection = connections.getString(i);
            if ("following".equals(connection)) {
                following = true;
            } else if ("followed_by".equals(connection)) {
                followedBy = true;
            }
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:20,代码来源:FriendshipJSONImpl.java

示例3: QueryResultJSONImpl

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
QueryResultJSONImpl(HttpResponse res, Configuration conf) throws TwitterException {
    super(res);
    JSONObject json = res.asJSONObject();
    try {
        JSONObject searchMetaData = json.getJSONObject("search_metadata");
        completedIn = getDouble("completed_in", searchMetaData);
        count = getInt("count", searchMetaData);
        maxId = getLong("max_id", searchMetaData);
        nextResults = searchMetaData.has("next_results") ? searchMetaData.getString("next_results") : null;
        query = getURLDecodedString("query", searchMetaData);
        refreshUrl = getUnescapedString("refresh_url", searchMetaData);
        sinceId = getLong("since_id", searchMetaData);

        JSONArray array = json.getJSONArray("statuses");
        tweets = new ArrayList<Status>(array.length());
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
        }
        for (int i = 0; i < array.length(); i++) {
            JSONObject tweet = array.getJSONObject(i);
            tweets.add(new StatusJSONImpl(tweet, conf));
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:27,代码来源:QueryResultJSONImpl.java

示例4: init

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    id = getInt("id", json);
    name = getRawString("name", json);
    fullName = getRawString("full_name", json);
    slug = getRawString("slug", json);
    description = getRawString("description", json);
    subscriberCount = getInt("subscriber_count", json);
    memberCount = getInt("member_count", json);
    uri = getRawString("uri", json);
    mode = "public".equals(getRawString("mode", json));
    following = getBoolean("following", json);

    try {
        if (!json.isNull("user")) {
            user = new UserJSONImpl(json.getJSONObject("user"));
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:21,代码来源:UserListJSONImpl.java

示例5: RelationshipJSONImpl

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
RelationshipJSONImpl(HttpResponse res, JSONObject json) throws TwitterException {
    super(res);
    try {
        JSONObject relationship = json.getJSONObject("relationship");
        JSONObject sourceJson = relationship.getJSONObject("source");
        JSONObject targetJson = relationship.getJSONObject("target");
        sourceUserId = getLong("id", sourceJson);
        targetUserId = getLong("id", targetJson);
        sourceUserScreenName = getUnescapedString("screen_name", sourceJson);
        targetUserScreenName = getUnescapedString("screen_name", targetJson);
        sourceBlockingTarget = getBoolean("blocking", sourceJson);
        sourceFollowingTarget = getBoolean("following", sourceJson);
        sourceFollowedByTarget = getBoolean("followed_by", sourceJson);
        sourceCanDm = getBoolean("can_dm", sourceJson);
        sourceNotificationsEnabled = getBoolean("notifications_enabled", sourceJson);
        wantRetweets = getBoolean("want_retweets", sourceJson);
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:21,代码来源:RelationshipJSONImpl.java

示例6: createSimilarPlaces

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
static SimilarPlaces createSimilarPlaces(HttpResponse res, Configuration conf) throws TwitterException {
    JSONObject json = null;
    try {
        json = res.asJSONObject();
        JSONObject result = json.getJSONObject("result");
        return new SimilarPlacesImpl(PlaceJSONImpl.createPlaceList(result.getJSONArray("places"), res, conf), res
                , result.getString("token"));
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:12,代码来源:SimilarPlacesImpl.java

示例7: createPlaceList

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
static ResponseList<Place> createPlaceList(HttpResponse res, Configuration conf) throws TwitterException {
    JSONObject json = null;
    try {
        json = res.asJSONObject();
        return createPlaceList(json.getJSONObject("result").getJSONArray("places"), res, conf);
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:10,代码来源:PlaceJSONImpl.java

示例8: init

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    try {
        name = json.getString("name");
        code = json.getString("code");
        status = json.getString(("status"));

    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:11,代码来源:LanguageJSONImpl.java

示例9: init

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    try {
        id = getLong("id", json);
        idStr = getRawString("id_str", json);
        name = getRawString("name", json);
        screenName = getRawString("screen_name", json);
        location = getRawString("location", json);

        // descriptionUrlEntities <=> entities/descriptions/urls[]
        try {
            descriptionURLEntities = getURLEntitiesFromJSON(json, "description");
            descriptionURLEntities = descriptionURLEntities == null ? new URLEntity[0] : descriptionURLEntities;

            // urlEntity <=> entities/url/urls[]
            URLEntity[] urlEntities = getURLEntitiesFromJSON(json, "url");
            if (urlEntities != null && urlEntities.length > 0) {
                urlEntity = urlEntities[0];
            }

            description = getRawString("description", json);
            if (description != null) {
                description = HTMLEntity.unescapeAndSlideEntityIncdices(description, null, descriptionURLEntities, null, null);
            }
        } catch (Exception e) {
            logger.error("Failed to parse user json: " + json.toString(), e);
        }

        isContributorsEnabled = getBoolean("contributors_enabled", json);
        profileImageUrl = getRawString("profile_image_url", json);
        profileImageUrlHttps = getRawString("profile_image_url_https", json);
        url = getRawString("url", json);
        isProtected = getBoolean("protected", json);
        following = getBooleanObject("following", json);
        isGeoEnabled = getBoolean("geo_enabled", json);
        isVerified = getBoolean("verified", json);
        translator = getBoolean("is_translator", json);
        followersCount = getInt("followers_count", json);

        profileBackgroundColor = getRawString("profile_background_color", json);
        profileTextColor = getRawString("profile_text_color", json);
        profileLinkColor = getRawString("profile_link_color", json);
        profileSidebarFillColor = getRawString("profile_sidebar_fill_color", json);
        profileSidebarBorderColor = getRawString("profile_sidebar_border_color", json);
        profileUseBackgroundImage = getBoolean("profile_use_background_image", json);
        showAllInlineMedia = getBoolean("show_all_inline_media", json);
        friendsCount = getInt("friends_count", json);
        createdAt = getDate("created_at", json, "EEE MMM dd HH:mm:ss z yyyy");
        favouritesCount = getInt("favourites_count", json);
        utcOffset = getInt("utc_offset", json);
        timeZone = getRawString("time_zone", json);
        profileBackgroundImageUrl = getRawString("profile_background_image_url", json);
        profileBackgroundImageUrlHttps = getRawString("profile_background_image_url_https", json);
        profileBannerImageUrl = getRawString("profile_banner_url", json);
        profileBackgroundTiled = getBoolean("profile_background_tile", json);
        lang = getRawString("lang", json);
        statusesCount = getInt("statuses_count", json);
        listedCount = getInt("listed_count", json);
        isFollowRequestSent = getBoolean("follow_request_sent", json);
        if (!json.isNull("status")) {
            JSONObject statusJSON = json.getJSONObject("status");
            status = new StatusJSONImpl(statusJSON);
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:67,代码来源:UserJSONImpl.java

示例10: init

import twitter4j.internal.org.json.JSONObject; //导入方法依赖的package包/类
private void init(JSONObject json) throws TwitterException {
    try {
        id = getLong("id", json);
        name = getRawString("name", json);
        screenName = getRawString("screen_name", json);
        location = getRawString("location", json);
        
        // descriptionUrlEntities <=> entities/descriptions/urls[]
        descriptionURLEntities = getURLEntitiesFromJSON(json, "description");
        descriptionURLEntities = descriptionURLEntities == null ? new URLEntity[0] : descriptionURLEntities;
        
        // urlEntity <=> entities/url/urls[]
        URLEntity[] urlEntities = getURLEntitiesFromJSON(json, "url");
        if (urlEntities != null && urlEntities.length > 0) {
            urlEntity = urlEntities[0];
        }
        
        description = getRawString("description", json);
        if (description != null) {
            description = HTMLEntity.unescapeAndSlideEntityIncdices(description, 
                    null, descriptionURLEntities, null, null);
        }
        
        isContributorsEnabled = getBoolean("contributors_enabled", json);
        profileImageUrl = getRawString("profile_image_url", json);
        profileImageUrlHttps = getRawString("profile_image_url_https", json);
        url = getRawString("url", json);
        isProtected = getBoolean("protected", json);
        isGeoEnabled = getBoolean("geo_enabled", json);
        isVerified = getBoolean("verified", json);
        translator = getBoolean("is_translator", json);
        followersCount = getInt("followers_count", json);

        profileBackgroundColor = getRawString("profile_background_color", json);
        profileTextColor = getRawString("profile_text_color", json);
        profileLinkColor = getRawString("profile_link_color", json);
        profileSidebarFillColor = getRawString("profile_sidebar_fill_color", json);
        profileSidebarBorderColor = getRawString("profile_sidebar_border_color", json);
        profileUseBackgroundImage = getBoolean("profile_use_background_image", json);
        showAllInlineMedia = getBoolean("show_all_inline_media", json);
        friendsCount = getInt("friends_count", json);
        createdAt = getDate("created_at", json, "EEE MMM dd HH:mm:ss z yyyy");
        favouritesCount = getInt("favourites_count", json);
        utcOffset = getInt("utc_offset", json);
        timeZone = getRawString("time_zone", json);
        profileBackgroundImageUrl = getRawString("profile_background_image_url", json);
        profileBackgroundImageUrlHttps = getRawString("profile_background_image_url_https", json);
        profileBannerImageUrl = getRawString("profile_banner_url", json);
        profileBackgroundTiled = getBoolean("profile_background_tile", json);
        lang = getRawString("lang", json);
        statusesCount = getInt("statuses_count", json);
        listedCount = getInt("listed_count", json);
        isFollowRequestSent = getBoolean("follow_request_sent", json);
        if (!json.isNull("status")) {
            JSONObject statusJSON = json.getJSONObject("status");
            status = new StatusJSONImpl(statusJSON);
        }
    } catch (JSONException jsone) {
        throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:62,代码来源:UserJSONImpl.java


注:本文中的twitter4j.internal.org.json.JSONObject.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。