1 package com.atlassian.marketplace.client.api;
2
3 import java.net.URI;
4
5 import static com.google.common.base.Preconditions.checkNotNull;
6
7
8
9
10
11 public final class PageReference<T>
12 {
13 private final URI uri;
14 private final QueryBounds bounds;
15 private final PageReader<T> reader;
16
17 public PageReference(URI uri, QueryBounds bounds, PageReader<T> reader)
18 {
19 this.uri = checkNotNull(uri);
20 this.bounds = checkNotNull(bounds);
21 this.reader = checkNotNull(reader);
22 }
23
24
25
26
27 public URI getUri()
28 {
29 return uri;
30 }
31
32
33
34
35 public QueryBounds getBounds()
36 {
37 return bounds;
38 }
39
40 public PageReader<T> getReader()
41 {
42 return reader;
43 }
44
45 @SuppressWarnings("unchecked")
46 @Override
47 public boolean equals(Object other)
48 {
49 if (other instanceof PageReference)
50 {
51 PageReference<T> p = (PageReference<T>) other;
52 return uri.equals(p.uri) && bounds.equals(p.bounds);
53 }
54 return false;
55 }
56
57 @Override
58 public int hashCode()
59 {
60 return uri.hashCode() + bounds.hashCode();
61 }
62 }