Exemplo n.º 1
0
 /*package*/
 static List<DirectMessage> constructDirectMessages(Response res, Weibo weibo)
     throws WeiboException {
   Document doc = res.asDocument();
   if (isRootNodeNilClasses(doc)) {
     return new ArrayList<DirectMessage>(0);
   } else {
     try {
       ensureRootNodeNameIs("direct-messages", doc);
       NodeList list = doc.getDocumentElement().getElementsByTagName("direct_message");
       int size = list.getLength();
       List<DirectMessage> messages = new ArrayList<DirectMessage>(size);
       for (int i = 0; i < size; i++) {
         Element status = (Element) list.item(i);
         messages.add(new DirectMessage(res, status, weibo));
       }
       return messages;
     } catch (WeiboException te) {
       if (isRootNodeNilClasses(doc)) {
         return new ArrayList<DirectMessage>(0);
       } else {
         throw te;
       }
     }
   }
 }
Exemplo n.º 2
0
 /*package*/ DirectMessage(Response res, Weibo weibo) throws WeiboException {
   super(res);
   init(res, res.asDocument().getDocumentElement(), weibo);
 }