1 package com.zone.weixin4j.response;
2
3
4
5
6
7
8
9
10
11
12 public class VideoResponse implements WeixinResponse {
13
14
15
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 }