com.seejoke.wechat.entity.msgbuilder.NewsBuilder Maven / Gradle / Ivy
package com.seejoke.wechat.entity.msgbuilder;
import com.seejoke.wechat.api.WxConsts;
import com.seejoke.wechat.entity.WxMessage;
import java.util.ArrayList;
import java.util.List;
/**
* 图文消息builder
*
*
* 用法:
* WxCustomMessage m = WxCustomMessage.NEWS().addArticle(article).toUser(...).build();
*
*
* @author diaodiaofly
*
*/
public final class NewsBuilder extends BaseBuilder {
private List articles = new ArrayList();
public NewsBuilder() {
this.msgType = WxConsts.CUSTOM_MSG_NEWS;
}
public NewsBuilder addArticle(WxMessage.WxArticle article) {
this.articles.add(article);
return this;
}
@Override
public WxMessage build() {
WxMessage m = super.build();
m.setArticles(this.articles);
return m;
}
}