Skip to content

Commit ddb5b23

Browse files
committed
remove unnecessary argument
1 parent fbc98ea commit ddb5b23

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/main/java/com/zaneli/qiita/QiitaExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,22 @@ <T extends QiitaResponse> PageableResponse<T> getPageableContents(
8888
String apiPath, Map<String, String> params, Class<T> responseType) throws IOException, QiitaException {
8989
params.put("per_page", Integer.toString(perPage));
9090
try {
91-
return getPageableContents(new URI(createQuery(createUrl(apiPath, token), params)), params, responseType);
91+
return getPageableContents(new URI(createQuery(createUrl(apiPath, token), params)), responseType);
9292
} catch (URISyntaxException e) {
9393
throw new QiitaException(e);
9494
}
9595
}
9696

9797
public <T extends QiitaResponse> PageableResponse<T> getPageableContents(
98-
URI uri, Map<String, String> params, Class<T> responseType) throws IOException, QiitaException {
98+
URI uri, Class<T> responseType) throws IOException, QiitaException {
9999
HttpGet request = new HttpGet(uri);
100100
HttpResponse response = execute(request);
101101
verifyStatusCode(response, SC_OK);
102102
String[] linkHeaderValues = getHeaderValues(response.getHeaders("Link"));
103103
try (InputStream in = response.getEntity().getContent()) {
104104
@SuppressWarnings("unchecked")
105105
T[] contents = JSON.decode(in, (Class<T[]>) Array.newInstance(responseType, 0).getClass());
106-
return new PageableResponse<>(this, params, responseType, contents, linkHeaderValues);
106+
return new PageableResponse<>(this, responseType, contents, linkHeaderValues);
107107
}
108108
}
109109

src/main/java/com/zaneli/qiita/model/response/PageableResponse.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.lang.reflect.Array;
66
import java.net.URI;
77
import java.net.URISyntaxException;
8-
import java.util.Collections;
9-
import java.util.Map;
108
import java.util.regex.Matcher;
119
import java.util.regex.Pattern;
1210

@@ -29,7 +27,6 @@ String getValue() {
2927
}
3028

3129
private final QiitaExecutor executor;
32-
private final Map<String, String> params;
3330
private final Class<T> responseType;
3431
private final T[] contents;
3532
private final URI firstUri;
@@ -38,15 +35,18 @@ String getValue() {
3835
private final URI lastUri;
3936

4037
public PageableResponse(
41-
QiitaExecutor executor, Map<String, String> params, Class<T> responseType, T[] contents, String[] linkHeaderValues) throws QiitaException {
38+
QiitaExecutor executor, Class<T> responseType, T[] contents, String[] linkHeaderValues) throws QiitaException {
4239
this.executor = executor;
43-
this.params = params;
4440
this.responseType = responseType;
4541
this.contents = contents;
4642
this.firstUri = retrieveUri(Rel.FIRST, linkHeaderValues);
4743
this.prevUri = retrieveUri(Rel.PREV, linkHeaderValues);
4844
this.nextUri = retrieveUri(Rel.NEXT, linkHeaderValues);
4945
this.lastUri = retrieveUri(Rel.LAST, linkHeaderValues);
46+
System.out.println(firstUri);
47+
System.out.println(prevUri);
48+
System.out.println(nextUri);
49+
System.out.println(lastUri);
5050
}
5151

5252
public T[] getContents() {
@@ -57,28 +57,28 @@ public PageableResponse<T> getFirst() throws IOException, QiitaException {
5757
if (firstUri == null) {
5858
return new NullPageableResponse<>(responseType);
5959
}
60-
return executor.getPageableContents(firstUri, params, responseType);
60+
return executor.getPageableContents(firstUri, responseType);
6161
}
6262

6363
public PageableResponse<T> getPrev() throws IOException, QiitaException {
6464
if (prevUri == null) {
6565
return new NullPageableResponse<>(responseType);
6666
}
67-
return executor.getPageableContents(prevUri, params, responseType);
67+
return executor.getPageableContents(prevUri, responseType);
6868
}
6969

7070
public PageableResponse<T> getNext() throws IOException, QiitaException {
7171
if (nextUri == null) {
7272
return new NullPageableResponse<>(responseType);
7373
}
74-
return executor.getPageableContents(nextUri, params, responseType);
74+
return executor.getPageableContents(nextUri, responseType);
7575
}
7676

7777
public PageableResponse<T> getLast() throws IOException, QiitaException {
7878
if (lastUri == null) {
7979
return new NullPageableResponse<>(responseType);
8080
}
81-
return executor.getPageableContents(lastUri, params, responseType);
81+
return executor.getPageableContents(lastUri, responseType);
8282
}
8383

8484
private static URI retrieveUri(Rel rel, String[] linkHeaderValues) throws QiitaException {
@@ -103,7 +103,7 @@ private static class NullPageableResponse<T extends QiitaResponse> extends Pagea
103103
private final T[] emptyContent;
104104
@SuppressWarnings("unchecked")
105105
NullPageableResponse(Class<T> responseType) throws QiitaException {
106-
super(null, Collections.<String, String>emptyMap(), responseType, null, new String[0]);
106+
super(null, responseType, null, new String[0]);
107107
this.emptyContent = (T[]) Array.newInstance(responseType, 0);
108108
}
109109
@Override

0 commit comments

Comments
 (0)