// Path: wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/vo/message/reply/NewsReply.java
// @XmlRootElement(name = "xml")
// @XmlAccessorType(XmlAccessType.FIELD)
// public class NewsReply extends Reply {
//     @XmlElement(name = "ArticleCount")
//     private int articleCount;
// 
//     @XmlElementWrapper(name = "Articles")
//     @XmlElement(name = "item")
//     private List<NewsDetail> articles;
// 
//     {
//         super.setMsgType(ReplyEnumFactory.NEWS.getReplyType());
//     }
// 
//     public NewsReply() {
//     }
// 
//     public NewsReply(int articleCount, List<NewsDetail> articles) {
//         this.articleCount = articleCount;
//         this.articles = articles;
//     }
// 
//     public int getArticleCount() {
//         return articleCount;
//     }
// 
//     public void setArticleCount(int articleCount) {
//         this.articleCount = articleCount;
//     }
// 
//     public List<NewsDetail> getArticles() {
//         return articles;
//     }
// 
//     public void setArticles(List<NewsDetail> articles) {
//         this.articles = articles;
//     }
// 
// }
// 
// Path: wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/vo/message/reply/detail/NewsDetail.java
// @XmlAccessorType(XmlAccessType.FIELD)
// public class NewsDetail extends AbstractToStringBuilder {
//     @XmlElement(name = "Title")
//     private String title;
// 
//     @XmlElement(name = "Description")
//     private String description;
// 
//     @XmlElement(name = "PicUrl")
//     private String picUrl;
// 
//     @XmlElement(name = "Url")
//     private String url;
// 
//     public NewsDetail() {
//     }
// 
//     public NewsDetail(String url) {
//         this.url = url;
//     }
// 
//     public NewsDetail(String title, String description, String picUrl, String url) {
//         this.title = title;
//         this.description = description;
//         this.picUrl = picUrl;
//         this.url = url;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getPicUrl() {
//         return picUrl;
//     }
// 
//     public void setPicUrl(String picUrl) {
//         this.picUrl = picUrl;
//     }
// 
//     public String getUrl() {
//         return url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
// }


import java.util.ArrayList;
import java.util.List;
import org.usc.wechat.mp.sdk.vo.ReplyDetail;
import org.usc.wechat.mp.sdk.vo.message.reply.NewsReply;
import org.usc.wechat.mp.sdk.vo.message.reply.Reply;
import org.usc.wechat.mp.sdk.vo.message.reply.detail.NewsDetail;
package org.usc.wechat.mp.sdk.factory.builder;



/**
 *
 * @author Shunli
 */
public class NewsReplyBuilder implements ReplyBuilder {
    @Override
    public Reply buildReply(List<ReplyDetail> replyDetails) {
        int size = replyDetails.size();
        List<NewsDetail> articles = new ArrayList<NewsDetail>(size);
        for (ReplyDetail replyDetailVo : replyDetails) {
            articles.add(new NewsDetail(
                    replyDetailVo.getTitle(),
                    replyDetailVo.getDescription(),
                    replyDetailVo.getMediaUrl(),
                    replyDetailVo.getUrl()));
        }

// Path: wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/vo/message/reply/NewsReply.java
// @XmlRootElement(name = "xml")
// @XmlAccessorType(XmlAccessType.FIELD)
// public class NewsReply extends Reply {
//     @XmlElement(name = "ArticleCount")
//     private int articleCount;
// 
//     @XmlElementWrapper(name = "Articles")
//     @XmlElement(name = "item")
//     private List<NewsDetail> articles;
// 
//     {
//         super.setMsgType(ReplyEnumFactory.NEWS.getReplyType());
//     }
// 
//     public NewsReply() {
//     }
// 
//     public NewsReply(int articleCount, List<NewsDetail> articles) {
//         this.articleCount = articleCount;
//         this.articles = articles;
//     }
// 
//     public int getArticleCount() {
//         return articleCount;
//     }
// 
//     public void setArticleCount(int articleCount) {
//         this.articleCount = articleCount;
//     }
// 
//     public List<NewsDetail> getArticles() {
//         return articles;
//     }
// 
//     public void setArticles(List<NewsDetail> articles) {
//         this.articles = articles;
//     }
// 
// }
// 
// Path: wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/vo/message/reply/detail/NewsDetail.java
// @XmlAccessorType(XmlAccessType.FIELD)
// public class NewsDetail extends AbstractToStringBuilder {
//     @XmlElement(name = "Title")
//     private String title;
// 
//     @XmlElement(name = "Description")
//     private String description;
// 
//     @XmlElement(name = "PicUrl")
//     private String picUrl;
// 
//     @XmlElement(name = "Url")
//     private String url;
// 
//     public NewsDetail() {
//     }
// 
//     public NewsDetail(String url) {
//         this.url = url;
//     }
// 
//     public NewsDetail(String title, String description, String picUrl, String url) {
//         this.title = title;
//         this.description = description;
//         this.picUrl = picUrl;
//         this.url = url;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public String getPicUrl() {
//         return picUrl;
//     }
// 
//     public void setPicUrl(String picUrl) {
//         this.picUrl = picUrl;
//     }
// 
//     public String getUrl() {
//         return url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
// }


// Path: wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/factory/builder/NewsReplyBuilder.java
import java.util.ArrayList;
import java.util.List;
import org.usc.wechat.mp.sdk.vo.ReplyDetail;
import org.usc.wechat.mp.sdk.vo.message.reply.NewsReply;
import org.usc.wechat.mp.sdk.vo.message.reply.Reply;
import org.usc.wechat.mp.sdk.vo.message.reply.detail.NewsDetail;

package org.usc.wechat.mp.sdk.factory.builder;



/**
 *
 * @author Shunli
 */
public class NewsReplyBuilder implements ReplyBuilder {
    @Override
    public Reply buildReply(List<ReplyDetail> replyDetails) {
        int size = replyDetails.size();
        List<NewsDetail> articles = new ArrayList<NewsDetail>(size);
        for (ReplyDetail replyDetailVo : replyDetails) {
            articles.add(new NewsDetail(
                    replyDetailVo.getTitle(),
                    replyDetailVo.getDescription(),
                    replyDetailVo.getMediaUrl(),
                    replyDetailVo.getUrl()));
        }

        return new NewsReply(size, articles);