Package com.github.jreddit.entity

Examples of com.github.jreddit.entity.Comment


        assertEquals(result.get(0).getFullName(), "t1_redditObjId1");
        assertEquals(result.get(1).getFullName(), "t1_redditObjId2");
        assertEquals(result.get(2).getFullName(), "t1_redditObjId3");
       
        // Comment1
        Comment comment1 = result.get(0);
        assertEquals(3, comment1.getReplies().size());
        assertEquals(comment1.getReplies().get(0).getFullName(), "t1_redditObjId11");
        assertEquals(comment1.getReplies().get(1).getFullName(), "t1_redditObjId12");
        assertEquals(comment1.getReplies().get(2).getFullName(), "t1_redditObjId13");
       
        // Comment11
        Comment comment11 = comment1.getReplies().get(0);
        assertEquals(2, comment11.getReplies().size());
        assertEquals(comment11.getReplies().get(0).getFullName(), "t1_redditObjId111");
        assertEquals(comment11.getReplies().get(1).getFullName(), "t1_redditObjId112");
       
        // Comment2
        Comment comment2 = result.get(1);
        assertEquals(2, comment2.getReplies().size());
        assertEquals(comment2.getReplies().get(0).getFullName(), "t1_redditObjId21");
        assertEquals(comment2.getReplies().get(1).getFullName(), "t1_redditObjId22");
       
    }
View Full Code Here


         
          JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get("children");
         
          // Iterate over the submission results
          JSONObject data;
          Comment comment;
          for (Object anArray : array) {
              data = (JSONObject) anArray;
             
              // Make sure it is of the correct kind
              String kind = safeJsonToString(data.get("kind"));
              if (kind.equals(Kind.COMMENT.value())) {
               
                // Contents of the comment
                data = ((JSONObject) data.get("data"));
               
                // Create and add the new comment
                comment = new Comment(data);
                comments.add(comment);
               
              }

          }
View Full Code Here

      // Get the comments in an array
        JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get("children");
       
        // Iterate over the submission results
        JSONObject data;
        Comment comment;
        for (Object anArray : array) {
            data = (JSONObject) anArray;
           
            // Make sure it is of the correct kind
            String kind = safeJsonToString(data.get("kind"));
            if (kind.equals(Kind.COMMENT.value())) {
             
              // Contents of the comment
              data = ((JSONObject) data.get("data"));
             
              // Create and add the new comment
              comment = new Comment(data);
              comments.add(comment);
             
              Object o = data.get("replies");
              if (o instanceof JSONObject) {
               
                // Dig towards the replies
                JSONObject replies = (JSONObject) o;
                parseRecursive(comment.getReplies(), replies);

              }
             
            } else if (kind.equals(Kind.MORE.value())) {
             
View Full Code Here

TOP

Related Classes of com.github.jreddit.entity.Comment

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.