weibo4j.model.Paging Maven / Gradle / Ivy
/*
* Copyright © 2021 pengjianqiang
* All rights reserved.
* 项目名称:微博开放平台API-JAVA SDK
* 项目描述:基于微博开放平台官网的weibo4j-oauth2-beta3.1.1包及新版接口做二次开发
* 项目地址:https://github.com/qqxadyy/weibo-openapi-4java
* 许可证信息:见下文
*
* ======================================================================
*
* src/main/java/weibo4j下的文件是从weibo4j-oauth2-beta3.1.1.zip中复制出来的
* 本项目对这个目录下的部分源码做了重新改造
* 但是许可信息和"https://github.com/sunxiaowei2014/weibo4j-oauth2-beta3.1.1"或源码中已存在的保持一致
*/
/*
Copyright (c) 2007-2009, Yusuke Yamamoto
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Yusuke Yamamoto nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package weibo4j.model;
/**
* Controlls pagination
*
* @author Yusuke Yamamoto - yusuke at mac.com
*/
public class Paging implements java.io.Serializable {
private static final long serialVersionUID = -3285857427993796670L;
private int page = -1; //页码。注意:最多返回200条分页内容。
private int count = -1; //指定每页返回的记录条数。
private long sinceId = -1; //若指定此参数,则只返回ID比since_id大(即比since_id发表时间晚的)的微博消息。
private long maxId = -1; //若指定此参数,则返回ID小于或等于max_id的微博消息
public Paging() {
}
public Paging(int page) {
setPage(page);
}
public Paging(long sinceId) {
setSinceId(sinceId);
}
public Paging(int page, int count) {
this(page);
setCount(count);
}
public Paging(int page, long sinceId) {
this(page);
setSinceId(sinceId);
}
public Paging(int page, int count, long sinceId) {
this(page, count);
setSinceId(sinceId);
}
public Paging(int page, int count, long sinceId, long maxId) {
this(page, count, sinceId);
setMaxId(maxId);
}
public int getPage() {
return page;
}
public void setPage(int page) {
if (page < 1) {
throw new IllegalArgumentException("page should be positive integer. passed:" + page);
}
this.page = page;
}
public int getCount() {
return count;
}
public void setCount(int count) {
if (count < 1) {
throw new IllegalArgumentException("count should be positive integer. passed:" + count);
}
this.count = count;
}
public Paging count(int count) {
setCount(count);
return this;
}
public long getSinceId() {
return sinceId;
}
public void setSinceId(int sinceId) {
if (sinceId < 1) {
throw new IllegalArgumentException("since_id should be positive integer. passed:" + sinceId);
}
this.sinceId = sinceId;
}
public Paging sinceId(int sinceId) {
setSinceId(sinceId);
return this;
}
public void setSinceId(long sinceId) {
if (sinceId < 1) {
throw new IllegalArgumentException("since_id should be positive integer. passed:" + sinceId);
}
this.sinceId = sinceId;
}
public Paging sinceId(long sinceId) {
setSinceId(sinceId);
return this;
}
public long getMaxId() {
return maxId;
}
public void setMaxId(long maxId) {
if (maxId < 1) {
throw new IllegalArgumentException("max_id should be positive integer. passed:" + maxId);
}
this.maxId = maxId;
}
public Paging maxId(long maxId) {
setMaxId(maxId);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy