Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

网络请求,泛型的返回数据的问题,跟#531有点像又有点不像 #729

Open
TeemoDong opened this issue Aug 12, 2021 · 0 comments

Comments

@TeemoDong
Copy link

我新建了class名为,BaseResultModel 并且加了@httpresponse(parser = JsonResponseParser.class)
@HttpResponse(parser = JsonResponseParser.class) public class BaseResultModel<T> { private int code; private T content; private int stat; private String errMsg; private long timeStamp; private String last_date;
因为每个接口都会返回这些东西,但是content可能是不同的json数据,所以想用泛型。但是在JsonResponseParser的parse的方法那儿,resultType确实能有BaseResultModel的泛型信息,但是不包括T的,然后原本数据里int的数据会自动帮我加1个小数点
123
如图所示 string的result是源数据,右下角是gson后的实体类数据,想请教大佬我应该怎么处理T的数据(其他数据是对的比兔code,stat,都是正常的int)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant