Package twitter4j.internal.org.json

Examples of twitter4j.internal.org.json.JSONObject$Null


            }
            JSONArray list = res.asJSONArray();
            int size = list.length();
            ResponseList<Friendship> friendshipList = new ResponseListImpl<Friendship>(size, res);
            for (int i = 0; i < size; i++) {
                JSONObject json = list.getJSONObject(i);
                Friendship friendship = new FriendshipJSONImpl(json);
                if (conf.isJSONStoreEnabled()) {
                    DataObjectFactoryUtil.registerJSONObject(friendship, json);
                }
                friendshipList.add(friendship);
View Full Code Here


        init(jsonStr, storeJSON);
    }

    void init(String jsonStr, boolean storeJSON) throws TwitterException {
        try {
            JSONObject json;
            if (jsonStr.startsWith("[")) {
                JSONArray array = new JSONArray(jsonStr);
                if (array.length() > 0) {
                    json = array.getJSONObject(0);
                } else {
                    throw new TwitterException("No trends found on the specified woeid");
                }
            } else {
                json = new JSONObject(jsonStr);
            }
            this.asOf = z_T4JInternalParseUtil.parseTrendsDate(json.getString("as_of"));
            this.location = extractLocation(json, storeJSON);
            JSONArray array = json.getJSONArray("trends");
            this.trendAt = asOf;
            this.trends = jsonArrayToTrendArray(array, storeJSON);
        } catch (JSONException jsone) {
            throw new TwitterException(jsone.getMessage(), jsone);
        }
View Full Code Here

    }

    /*package*/
    static ResponseList<Trends> createTrendsList(HttpResponse res, boolean storeJSON) throws
            TwitterException {
        JSONObject json = res.asJSONObject();
        ResponseList<Trends> trends;
        try {
            Date asOf = z_T4JInternalParseUtil.parseTrendsDate(json.getString("as_of"));
            JSONObject trendsJson = json.getJSONObject("trends");
            Location location = extractLocation(json, storeJSON);
            trends = new ResponseListImpl<Trends>(trendsJson.length(), res);
            Iterator ite = trendsJson.keys();
            while (ite.hasNext()) {
                String key = (String) ite.next();
                JSONArray array = trendsJson.getJSONArray(key);
                Trend[] trendsArray = jsonArrayToTrendArray(array, storeJSON);
                if (key.length() == 19) {
                    // current trends
                    trends.add(new TrendsJSONImpl(asOf, location, getDate(key
                            , "yyyy-MM-dd HH:mm:ss"), trendsArray));
View Full Code Here

    }

    private static Trend[] jsonArrayToTrendArray(JSONArray array, boolean storeJSON) throws JSONException {
        Trend[] trends = new Trend[array.length()];
        for (int i = 0; i < array.length(); i++) {
            JSONObject trend = array.getJSONObject(i);
            trends[i] = new TrendJSONImpl(trend, storeJSON);
        }
        return trends;
    }
View Full Code Here

                }
            }
            if (!json.isNull("display_url")) {
                this.displayURL = json.getString("display_url");
            }
            JSONObject sizes = json.getJSONObject("sizes");
            this.sizes = new HashMap<Integer, MediaEntity.Size>(4);
            this.sizes.put(MediaEntity.Size.LARGE, new Size(sizes.getJSONObject("large")));
            this.sizes.put(MediaEntity.Size.MEDIUM, new Size(sizes.getJSONObject("medium")));
            this.sizes.put(MediaEntity.Size.SMALL, new Size(sizes.getJSONObject("small")));
            this.sizes.put(MediaEntity.Size.THUMB, new Size(sizes.getJSONObject("thumb")));
        } catch (JSONException jsone) {
            throw new TwitterException(jsone);
        }

    }
View Full Code Here

        if (placesCountdown > 0
                && StringUtils.isNotEmpty(LOCATION.getS(node))
                && !GEOQUALITY.exists(node)
                ) {
            try {
                JSONObject result = places.getPlace(LOCATION.getS(node));
                if (places.isOk(result)) {
                    if (places.getFound(result) > 0) {
                        LATITUDE.set(node, Double.parseDouble(places.getLatitude(result)));
                        LONGITUDE.set(node, Double.parseDouble(places.getLongitude(result)));
                        GEOQUALITY.set(node, places.getGeoQuality(result));
View Full Code Here

public class YahooTest {
    private Logger log = LoggerFactory.getLogger(YahooTest.class);
    @Test
    public void testPlaces() throws Exception {
        YahooPlaces y = new YahooPlaces();
        JSONObject result = y.getPlace("Miesbach");
        log.info(result.toString(2));
        assertTrue(y.isOk(result));
        assertEquals(y.getLatitude(result), "47.789140");
        assertEquals(y.getLongitude(result), "11.833420");
        assertEquals(y.getGeoQuality(result), 40);
        assertEquals(y.getCountry(result), "Germany");
View Full Code Here

TOP

Related Classes of twitter4j.internal.org.json.JSONObject$Null

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.