View Javadoc
1   package com.foxinmy.weixin4j.response;
2   
3   /**
4    * 回复视频消息
5    * 
6    * @className VideoResponse
7    * @author jinyu(foxinmy@gmail.com)
8    * @date 2015年5月5日
9    * @since JDK 1.6
10   * @see
11   */
12  public class VideoResponse implements WeixinResponse {
13  
14  	/**
15  	 * 通过上传多媒体文件,得到的id
16  	 */
17  	private String mediaId;
18  	/**
19  	 * 视频消息标题
20  	 */
21  	private String title;
22  	/**
23  	 * 视频消息描述
24  	 */
25  	private String desc;
26  
27  	public VideoResponse(String mediaId) {
28  		this.mediaId = mediaId;
29  	}
30  
31  	public VideoResponse(String mediaId, String title, String desc) {
32  		this.mediaId = mediaId;
33  		this.title = title;
34  		this.desc = desc;
35  	}
36  
37  	@Override
38  	public String toContent() {
39  		StringBuilder content = new StringBuilder();
40  		content.append("<Video>");
41  		content.append(String.format("<MediaId><![CDATA[%s]]></MediaId>",
42  				mediaId));
43  		content.append(String.format("<Title><![CDATA[%s]]></Title>",
44  				title != null ? title : ""));
45  		content.append(String.format(
46  				"<Description><![CDATA[%s]]></Description>",
47  				desc != null ? desc : ""));
48  		content.append("</Video>");
49  		return content.toString();
50  	}
51  
52  	public String getMediaId() {
53  		return mediaId;
54  	}
55  
56  	public String getTitle() {
57  		return title;
58  	}
59  
60  	public void setTitle(String title) {
61  		this.title = title;
62  	}
63  
64  	public String getDesc() {
65  		return desc;
66  	}
67  
68  	public void setDesc(String desc) {
69  		this.desc = desc;
70  	}
71  
72  	@Override
73  	public String getMsgType() {
74  		return "video";
75  	}
76  }