-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathOtherApi.java
More file actions
executable file
·66 lines (47 loc) · 1.43 KB
/
Copy pathOtherApi.java
File metadata and controls
executable file
·66 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package example.api;
import example.dto.*;
import example.ApiClient;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
/**
* 其他接口
*/
public class OtherApi {
private final ApiClient client;
public OtherApi(ApiClient client) {
this.client = client;
}
public static final TypeReference<String> getResultType = new TypeReference<String>() {
};
/**
* 响应基础类型
*
*/
public String get() {
Map<String,Object> params = new HashMap<String,Object>();
return client.get("/other/long",params, getResultType);
}
public static final TypeReference<Integer> getContentResultType = new TypeReference<Integer>() {
};
/**
* 响应基础类型
*
*/
public Integer getContent() {
Map<String,Object> params = new HashMap<String,Object>();
return client.get("/other/string",params, getContentResultType);
}
public static final TypeReference<List<Dog>> multiplePathVariableResultType = new TypeReference<List<Dog>>() {
};
/**
* 多路径参数
*
*/
public List<Dog> multiplePathVariable( String id, String type) {
Map<String,Object> params = new HashMap<String,Object>();
return client.get(String.format("/other/boolean/%s/%s",type,id),params, multiplePathVariableResultType);
}
}