Package facebook4j.internal.org.json

Examples of facebook4j.internal.org.json.JSONArray


    private static ResponseList<JSONObject> createJSONObjectList(JSONObject json, Configuration conf) throws FacebookException {
        try {
            if (null != conf && conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONArray jsonArray = json.getJSONArray("data");
            final int size = jsonArray.length();
            ResponseList<JSONObject> results = new ResponseListImpl<JSONObject>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                if (null != conf && conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(jsonObject, jsonObject);
                }
                results.add(jsonObject);
            }
View Full Code Here


        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Like> likes = new ResponseListImpl<Like>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject likeJSONObject = list.getJSONObject(i);
                Like like = new LikeJSONImpl(likeJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(like, likeJSONObject);
                }
                likes.add(like);
View Full Code Here

                accessToken = getRawString("access_token", json);
            }
            category = getRawString("category", json);
            id = getRawString("id", json);
            if (!json.isNull("perms")) {
                JSONArray permsJSONArray = json.getJSONArray("perms");
                final int size = permsJSONArray.length();
                perms = new ArrayList<String>(size);
                for (int i = 0; i < size; i++) {
                    perms.add((String) permsJSONArray.get(i));
                }
            } else {
                perms = Collections.emptyList();
            }
        } catch (JSONException jsone) {
View Full Code Here

        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Account> accounts = new ResponseListImpl<Account>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject accountJSONObject = list.getJSONObject(i);
                Account account = new AccountJSONImpl(accountJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(account, accountJSONObject);
                }
                accounts.add(account);
View Full Code Here

        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Book> books = new ResponseListImpl<Book>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject bookJSONObject = list.getJSONObject(i);
                Book book = new BookJSONImpl(bookJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(book, bookJSONObject);
                }
                books.add(book);
View Full Code Here

    public static List<String> getStringList(String name, JSONObject json) throws FacebookException {
        if (json.isNull(name)) {
            return Collections.emptyList();
        }
        try {
            JSONArray jsonArray = json.getJSONArray(name);
            final int size = jsonArray.length();
            List<String> result = new ArrayList<String>(size);
            for (int i = 0; i < size; i++) {
                result.add(jsonArray.getString(i));
            }
            return result;
        } catch (JSONException jsone) {
            throw new FacebookException(jsone.getMessage(), jsone);
        }
View Full Code Here

            link = getRawString("link", json);
            name = getRawString("name", json);
            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 tag = new CommentJSONImpl(list.getJSONObject(i));
                        comments.add(tag);
                    }
                } else {
                    comments = new PagableListImpl<Comment>(1, commentsJSONObject);
                }
View Full Code Here

        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Link> links = new ResponseListImpl<Link>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject linkJSONObject = list.getJSONObject(i);
                Link link = new LinkJSONImpl(linkJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(link, linkJSONObject);
                }
                links.add(link);
View Full Code Here

        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Milestone> milestones = new ResponseListImpl<Milestone>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject eventJSONObject = list.getJSONObject(i);
                Milestone milestone = new MilestoneJSONImpl(eventJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(milestone, eventJSONObject);
                }
                milestones.add(milestone);
View Full Code Here

        try {
            if (conf.isJSONStoreEnabled()) {
                DataObjectFactoryUtil.clearThreadLocalMap();
            }
            JSONObject json = res.asJSONObject();
            JSONArray list = json.getJSONArray("data");
            final int size = list.length();
            ResponseList<Friend> friends = new ResponseListImpl<Friend>(size, json);
            for (int i = 0; i < size; i++) {
                JSONObject friendJSONObject = list.getJSONObject(i);
                Friend friend = new FriendJSONImpl(friendJSONObject);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(friend, friendJSONObject);
                }
                friends.add(friend);
View Full Code Here

TOP

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

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.