我有AutoValue(和android-apt插件)在一个项目中工作,我意识到Ryan Harter的AutoValue的gson扩展,但是如何将Retrofit 2挂接到使用扩展和工厂方法抽象类?如何使用AutoValue进行改造2?
String grantType = "password";
Call<SignIn> signInCall = retrofitApi.signIn(email, password, grantType);
signInCall.enqueue(callback);
例如,在这里,我想用AutoValue与签到JSON模型对象执行不可改变,但我怎么挂钩改造(或者更具体GSON)的不可变的,AutoValue模型类?
很好的解释,欣赏它。我有大部分的工作,但我无法找到AutoValueGsonTypeAdapterFactory。继续收到此错误 “错误:(40,57)错误:无法找到符号类AutoValueGsonTypeAdapterFactory” – 3xplore
您必须在实现TypeAdapterFactory的抽象类上使用@GsonTypeAdapterFactory。检查它在那里https://github.com/rharter/auto-value-gson#factory –