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

com.litongjava.table.model.DataPageRequest Maven / Gradle / Ivy

There is a newer version: 1.4.8
Show newest version
package com.litongjava.table.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@AllArgsConstructor
@Builder
public class DataPageRequest {
  private Integer pageNo, pageSize;

  public DataPageRequest() {
    this.pageNo = 1;
    this.pageSize = 10;
  }

  public DataPageRequest(TableInput kv) {
    Object pageNo = kv.remove("page_no");
    this.pageNo = getIntegerValue(pageNo, 1);
    Object pageSize = kv.remove("page_size");
    this.pageSize = getIntegerValue(pageSize, 10);
  }

  private Integer getIntegerValue(Object v, Integer defaultValue) {
    if (v == null) {
      return defaultValue;
    } else {
      if (v instanceof Integer) {
        return (Integer) v;
      } else {
        return Integer.parseInt((String) v);
      }
    }

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy