- 👋 Hi, I’m @LiushuiXiaoxia
- 👀 I’m interested in ...
- 🌱 I’m currently learning ...
- 💞️ I’m looking to collaborate on ...
- 📫 How to reach me ...
liushuixiaoxia / autovaluedemo Goto Github PK
View Code? Open in Web Editor NEWAndroid Model正确使用姿势——AutoValue
Android Model正确使用姿势——AutoValue
@GsonTypeAdapterFactory
public abstract class MyAdapterFactory implements TypeAdapterFactory {
public static TypeAdapterFactory create() {
return new AutoValueGson_MyAdapterFactory();
}
}
找不到AutoValueGson_MyAdapterFactory ;其他AutoValue可以生成成功,求指导
@AutoValue
public abstract class Result<T> {
public abstract int code();
public abstract String error();
public abstract T data();
public static <T> TypeAdapter<Result<T>> typeAdapter(Gson gson, TypeToken<T> typeToken) {
return new AutoValue_Result.GsonTypeAdapter(gson, typeToken).nullSafe();
}
}
请求返回固定格式,这样一个泛型,请求成功是没有问题,但是失败了,返回
{"code":0,"error":"","data":""}或{"code":0,"error":""}解析都出错,这种怎么解决呢?(不使用autovalue是没有问题的)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.