View Javadoc
1   package com.foxinmy.weixin4j.model.media;
2   
3   import java.io.Serializable;
4   import java.util.List;
5   
6   import com.alibaba.fastjson.annotation.JSONField;
7   import com.foxinmy.weixin4j.model.paging.Pageable;
8   import com.foxinmy.weixin4j.model.paging.Pagedata;
9   import com.foxinmy.weixin4j.type.MediaType;
10  
11  /**
12   * 媒体素材记录
13   *
14   * @className MediaRecord
15   * @author jinyu(foxinmy@gmail.com)
16   * @date 2015年3月22日
17   * @since JDK 1.6
18   * @see
19   */
20  public class MediaRecord implements Serializable {
21  
22  	private static final long serialVersionUID = 7017503153256241457L;
23  
24  	/**
25  	 * 该类型的素材的总数
26  	 */
27  	@JSONField(name = "total_count")
28  	private int totalCount;
29  	/**
30  	 * 本次调用获取的素材的数量
31  	 */
32  	@JSONField(name = "item_count")
33  	private int itemCount;
34  	/**
35  	 * 媒体类型
36  	 */
37  	@JSONField(serialize = false, deserialize = false)
38  	private MediaType mediaType;
39  	/**
40  	 * 媒体信息
41  	 */
42  	@JSONField(name = "items")
43  	private List<MediaItem> items;
44  	/**
45  	 * 分页信息
46  	 */
47  	@JSONField(serialize = false, deserialize = false)
48  	private Pageable pageable;
49  	@JSONField(serialize = false, deserialize = false)
50  	private volatile Pagedata<MediaItem> pagedata;
51  
52  	public int getTotalCount() {
53  		return totalCount;
54  	}
55  
56  	public void setTotalCount(int totalCount) {
57  		this.totalCount = totalCount;
58  	}
59  
60  	public int getItemCount() {
61  		return itemCount;
62  	}
63  
64  	public void setItemCount(int itemCount) {
65  		this.itemCount = itemCount;
66  	}
67  
68  	public MediaType getMediaType() {
69  		return mediaType;
70  	}
71  
72  	public void setMediaType(MediaType mediaType) {
73  		this.mediaType = mediaType;
74  	}
75  
76  	public List<MediaItem> getItems() {
77  		return items;
78  	}
79  
80  	public void setItems(List<MediaItem> items) {
81  		this.items = items;
82  	}
83  
84  	public Pageable getPageable() {
85  		return pageable;
86  	}
87  
88  	public void setPageable(Pageable pageable) {
89  		this.pageable = pageable;
90  	}
91  
92  	public Pagedata<MediaItem> getPagedata() {
93  		if (pagedata == null) {
94  			pagedata = new Pagedata<MediaItem>(pageable, totalCount, items);
95  		}
96  		return pagedata;
97  	}
98  
99  	@Override
100 	public String toString() {
101 		return "MediaRecord [totalCount=" + totalCount + ", itemCount="
102 				+ itemCount + ", mediaType=" + mediaType + ", items=" + items
103 				+ ", pageable=" + pageable + "]";
104 	}
105 }