v0.1.0 #20

Merged
timi merged 1 commits from dev into master 2026-10-01 10:46:46 +00:00
2 changed files with 10 additions and 10 deletions
Showing only changes of commit 113cdeb0d9 - Show all commits
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>com.imyeyu.network</groupId>
<artifactId>timi-network</artifactId>
<version>0.0.14</version>
<version>0.1.0</version>
<packaging>jar</packaging>
<properties>
@@ -106,7 +106,7 @@
<dependency>
<groupId>com.imyeyu.io</groupId>
<artifactId>timi-io</artifactId>
<version>0.0.5</version>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
@@ -3,7 +3,7 @@ package com.imyeyu.network;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.imyeyu.java.bean.CallbackArg;
import com.imyeyu.java.bean.timi.TimiResponse;
import com.imyeyu.java.bean.Response;
import org.apache.hc.client5.http.fluent.Request;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpResponse;
@@ -94,7 +94,7 @@ public class TimiRequest extends JacksonRequest {
* @throws IOException 读取或解析失败
*/
public <T> T resultAs(Class<T> clazz) throws IOException {
TimiResponse<T> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(clazz));
Response<T> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(clazz));
if (resp.isFail()) {
throw resp.toException();
}
@@ -110,7 +110,7 @@ public class TimiRequest extends JacksonRequest {
* @throws IOException 读取或解析失败
*/
public <T> T resultAs(TypeReference<T> typeReference) throws IOException {
TimiResponse<T> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(typeReference));
Response<T> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(typeReference));
if (resp.isFail()) {
throw resp.toException();
}
@@ -126,7 +126,7 @@ public class TimiRequest extends JacksonRequest {
* @throws IOException 读取或解析失败
*/
public <T> T resultAs(Type type) throws IOException {
TimiResponse<T> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(type));
Response<T> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(type));
if (resp.isFail()) {
throw resp.toException();
}
@@ -135,7 +135,7 @@ public class TimiRequest extends JacksonRequest {
@Override
public void execute() throws IOException {
TimiResponse<?> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(Object.class));
Response<?> resp = getObjectMapper().treeToValue(asJsonObject(), timiResponseType(Object.class));
if (resp.isFail()) {
throw resp.toException();
}
@@ -148,7 +148,7 @@ public class TimiRequest extends JacksonRequest {
* @return Jackson 类型
*/
protected JavaType timiResponseType(Class<?> clazz) {
return getObjectMapper().getTypeFactory().constructParametricType(TimiResponse.class, clazz);
return getObjectMapper().getTypeFactory().constructParametricType(Response.class, clazz);
}
/**
@@ -158,7 +158,7 @@ public class TimiRequest extends JacksonRequest {
* @return Jackson 类型
*/
protected JavaType timiResponseType(TypeReference<?> typeReference) {
return getObjectMapper().getTypeFactory().constructParametricType(TimiResponse.class, getObjectMapper().constructType(typeReference));
return getObjectMapper().getTypeFactory().constructParametricType(Response.class, getObjectMapper().constructType(typeReference));
}
/**
@@ -168,6 +168,6 @@ public class TimiRequest extends JacksonRequest {
* @return Jackson 类型
*/
protected JavaType timiResponseType(Type type) {
return getObjectMapper().getTypeFactory().constructParametricType(TimiResponse.class, getObjectMapper().constructType(type));
return getObjectMapper().getTypeFactory().constructParametricType(Response.class, getObjectMapper().constructType(type));
}
}