@@ -23,6 +23,9 @@ private static enum Rel {
23
23
private Rel (String value ) {
24
24
this .value = value ;
25
25
}
26
+ String getValue () {
27
+ return value ;
28
+ }
26
29
}
27
30
28
31
private final QiitaExecutor executor ;
@@ -52,34 +55,34 @@ public T[] getContents() {
52
55
53
56
public PageableResponse <T > getFirst () throws IOException , QiitaException {
54
57
if (firstUri == null ) {
55
- return new NullPageableResponse <T >(responseType , contents );
58
+ return new NullPageableResponse <>(responseType );
56
59
}
57
60
return executor .getPageableContents (firstUri , params , responseType );
58
61
}
59
62
60
63
public PageableResponse <T > getPrev () throws IOException , QiitaException {
61
64
if (prevUri == null ) {
62
- return new NullPageableResponse <T >(responseType , contents );
65
+ return new NullPageableResponse <>(responseType );
63
66
}
64
67
return executor .getPageableContents (prevUri , params , responseType );
65
68
}
66
69
67
70
public PageableResponse <T > getNext () throws IOException , QiitaException {
68
71
if (nextUri == null ) {
69
- return new NullPageableResponse <T >(responseType , contents );
72
+ return new NullPageableResponse <>(responseType );
70
73
}
71
74
return executor .getPageableContents (nextUri , params , responseType );
72
75
}
73
76
74
77
public PageableResponse <T > getLast () throws IOException , QiitaException {
75
78
if (lastUri == null ) {
76
- return new NullPageableResponse <T >(responseType , contents );
79
+ return new NullPageableResponse <>(responseType );
77
80
}
78
81
return executor .getPageableContents (lastUri , params , responseType );
79
82
}
80
83
81
84
private static URI retrieveUri (Rel rel , String [] linkHeaderValues ) throws QiitaException {
82
- Pattern pattern = Pattern .compile ("^<(.+)>;\\ s+rel=\" " + rel .value + "\" $" );
85
+ Pattern pattern = Pattern .compile ("^<(.+)>;\\ s+rel=\" " + rel .getValue () + "\" $" );
83
86
for (String linkHeaderValue : linkHeaderValues ) {
84
87
String [] splitedLinkHeaderValues = linkHeaderValue .split ("," );
85
88
for (String splitedLinkHeaderValue : splitedLinkHeaderValues ) {
@@ -99,7 +102,7 @@ private static URI retrieveUri(Rel rel, String[] linkHeaderValues) throws QiitaE
99
102
private static class NullPageableResponse <T extends QiitaResponse > extends PageableResponse <T > {
100
103
private final T [] emptyContent ;
101
104
@ SuppressWarnings ("unchecked" )
102
- private NullPageableResponse (Class <T > responseType , T [] orgContents ) throws QiitaException {
105
+ NullPageableResponse (Class <T > responseType ) throws QiitaException {
103
106
super (null , Collections .<String , String >emptyMap (), responseType , null , new String [0 ]);
104
107
this .emptyContent = (T []) Array .newInstance (responseType , 0 );
105
108
}
0 commit comments