All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.chanjar.weixin.mp.builder.kefu.NewsBuilder Maven / Gradle / Ivy

The newest version!
package me.chanjar.weixin.mp.builder.kefu;

import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 图文消息builder
 * 
 * 用法:
 * WxMpKefuMessage m = WxMpKefuMessage.NEWS().addArticle(article).toUser(...).build();
 * 
* * @author chanjarster */ public final class NewsBuilder extends BaseBuilder { private List articles = new ArrayList<>(); public NewsBuilder() { this.msgType = WxConsts.KefuMsgType.NEWS; } public NewsBuilder addArticle(WxMpKefuMessage.WxArticle... articles) { Collections.addAll(this.articles, articles); return this; } public NewsBuilder articles(List articles) { this.articles = articles; return this; } @Override public WxMpKefuMessage build() { WxMpKefuMessage m = super.build(); m.setArticles(this.articles); return m; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy