Package facebook4j.internal.org.json

Examples of facebook4j.internal.org.json.JSONObject


    private void init(JSONObject json) throws FacebookException {
        try {
            id = getRawString("id", json);
            if (!json.isNull("from")) {
                JSONObject fromJSONObject = json.getJSONObject("from");
                from = new CategoryJSONImpl(fromJSONObject);
            }
            name = getRawString("name", json);
            description = getRawString("description", json);
            location = getRawString("location", json);
            link = getURL("link", json);
            coverPhoto = getRawString("cover_photo", json);
            privacy = PrivacyType.getInstance(getRawString("privacy", json));
            count = getInt("count", json);
            type = getRawString("type", json);
            createdTime = getISO8601Datetime("created_time", json);
            updatedTime = getISO8601Datetime("updated_time", json);
            canUpload = getBoolean("can_upload", json);
            if (!json.isNull("place")) {
                JSONObject placeJSONObject = json.getJSONObject("place");
                place = new PlaceJSONImpl(placeJSONObject);
            }
           
            if (!json.isNull("likes")) {
                JSONObject likesJSONObject = json.getJSONObject("likes");
                if (!likesJSONObject.isNull("data")) {
                    JSONArray list = likesJSONObject.getJSONArray("data");
                    final int size = list.length();
                    likes = new PagableListImpl<Like>(size, likesJSONObject);
                    for (int i = 0; i < size; i++) {
                        LikeJSONImpl like = new LikeJSONImpl(list.getJSONObject(i));
                        likes.add(like);
                    }
                } else {
                    likes = new PagableListImpl<Like>(1, likesJSONObject);
                }
            } else {
                likes = new PagableListImpl<Like>(0);
            }

            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);
View Full Code Here


    static ResponseList<Album> createAlbumList(HttpResponse res, Configuration conf) throws FacebookException {
        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Album> albums = new ResponseListImpl<Album>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject albumJSONObject = list.getJSONObject(i);
                Album album = new AlbumJSONImpl(albumJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(album, albumJSONObject);
                }
                albums.add(album);
View Full Code Here

    private String relationship;
   
    /*package*/FamilyJSONImpl(HttpResponse res, Configuration conf) throws FacebookException {
        super(res, conf);
        JSONObject json = res.asJSONObject();
        init(json);
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
            DataObjectFactoryUtil.registerJSONObject(this, json);
        }
View Full Code Here

    static ResponseList<Family> createFamilyList(HttpResponse res, Configuration conf) throws FacebookException {
        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Family> familys = new ResponseListImpl<Family>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject familyJSONObject = list.getJSONObject(i);
                Family family = new FamilyJSONImpl(familyJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(family, familyJSONObject);
                }
                familys.add(family);
View Full Code Here

        if (!json.isNull("count")) {
            count = getInt("count", json);
        }
        try {
            if (!json.isNull("paging")) {
                JSONObject pagingJSONObject = json.getJSONObject("paging");
                paging = new PagingJSONImpl<T>(pagingJSONObject, jsonObjectType);
            }
        } catch (JSONException jsone) {
            throw new FacebookException(jsone.getMessage(), jsone);
        }
View Full Code Here

    static ResponseList<Subscribedto> createSubscribedtoList(HttpResponse res, Configuration conf) throws FacebookException {
        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Subscribedto> subscribedtos = new ResponseListImpl<Subscribedto>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject subscribedtoJSONObject = list.getJSONObject(i);
                Subscribedto subscribedto = new SubscribedtoJSONImpl(subscribedtoJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(subscribedto, subscribedtoJSONObject);
                }
                subscribedtos.add(subscribedto);
View Full Code Here

    }

    private void init(JSONObject json) throws FacebookException {
        try {
            if (!json.isNull("summary")) {
                JSONObject summaryJSONObject = json.getJSONObject("summary");
                inboxSummary = new InboxSummaryJSONImpl(summaryJSONObject);
            }
        } catch (JSONException jsone) {
            throw new FacebookException(jsone.getMessage(), jsone);
        }
View Full Code Here

    private Date updatedTime;
    private PagableList<Question.Option> options;

    /*package*/QuestionJSONImpl(HttpResponse res, Configuration conf) throws FacebookException {
        super(res);
        JSONObject json = res.asJSONObject();
        init(json);
        if (conf.isJSONStoreEnabled()) {
            DataObjectFactoryUtil.clearThreadLocalMap();
            DataObjectFactoryUtil.registerJSONObject(this, json);
        }
View Full Code Here

    private void init(JSONObject json) throws FacebookException {
        try {
            id = getRawString("id", json);
            if (!json.isNull("from")) {
                JSONObject fromJSONObject = json.getJSONObject("from");
                from = new CategoryJSONImpl(fromJSONObject);
            }
            question = getRawString("question", json);
            createdTime = getISO8601Datetime("created_time", json);
            updatedTime = getISO8601Datetime("updated_time", json);
            if (!json.isNull("options")) {
                JSONObject optionsJSONObject = json.getJSONObject("options");
                options = createOptionList(optionsJSONObject);
            } else {
                options = new PagableListImpl<Question.Option>(0);
            }
        } catch (JSONException jsone) {
View Full Code Here

    static ResponseList<Question> createQuestionList(HttpResponse res, Configuration conf) throws FacebookException {
        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Question> questions = new ResponseListImpl<Question>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject questionJSONObject = list.getJSONObject(i);
                Question question = new QuestionJSONImpl(questionJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(question, questionJSONObject);
                }
                questions.add(question);
View Full Code Here

TOP

Related Classes of facebook4j.internal.org.json.JSONObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.