Project

General

Profile

1
package eu.dnetlib.repo.manager.domain;
2

    
3

    
4
import javax.validation.constraints.NotNull;
5
import java.util.ArrayList;
6
import java.util.List;
7

    
8
public class Paging<T> {
9

    
10
    private int total;
11

    
12
    private int from;
13

    
14
    private int to;
15

    
16
    private List<T> results;
17

    
18
    public Paging(int total, int from, int to, List<T> results) {
19
        this.total = total;
20
        this.from = from;
21
        this.to = to;
22
        this.results = results;
23
    }
24

    
25
    public Paging(@NotNull Paging<T> page) {
26
        this.total = page.getTotal();
27
        this.from = page.getFrom();
28
        this.to = page.getTo();
29
        this.results = page.getResults();
30
    }
31

    
32
    public <K> Paging(@NotNull Paging<K> page, List<T> results) {
33
        this.total = page.getTotal();
34
        this.from = page.getFrom();
35
        this.to = page.getTo();
36
        this.results = results;
37
    }
38

    
39
    public Paging() {
40
        this.total = 0;
41
        this.from = 0;
42
        this.to = 0;
43
        this.results = new ArrayList<>();
44
    }
45

    
46
    public int getTotal() {
47
        return total;
48
    }
49

    
50
    public void setTotal(int total) {
51
        this.total = total;
52
    }
53

    
54
    public int getFrom() {
55
        return from;
56
    }
57

    
58
    public void setFrom(int from) {
59
        this.from = from;
60
    }
61

    
62
    public int getTo() {
63
        return to;
64
    }
65

    
66
    public void setTo(int to) {
67
        this.to = to;
68
    }
69

    
70
    public List<T> getResults() {
71
        return results;
72
    }
73

    
74
    public void setResults(List<T> results) {
75
        this.results = results;
76
    }
77
}
(18-18/32)