0
我試圖從Realm
獲取數據並將其發送到使用retrofit
服務器和解析和序列我使用LoganSquare
無法映射到一個JSON對象Logansquare
client = new Retrofit.Builder()
.baseUrl(REST_ENDPOINT)
.client(okHttpClient)
.addConverterFactory(LoganSquareConverterFactory.create())
.build();
這是怎麼我正在訪問記錄
Appointment appointments = DB.getInstance(mContext).selectNotSyncAppointmentsData();
RestApi.AppointmentsDataApi service = getAppointmentsDataApi();
Call<APResponse> call = service.createUpdateAppointmentsData(appointments);
我收到以下錯誤
createUpdateAppointmentData : onFailure Class io.realm.AppointmentRealmProxy could not be mapped to a JSON object. Perhaps it hasn't been annotated with @JsonObject?
LoganSquare使用APT來生成分別使用'@ JsonObject'和'@在類JsonField'註釋及其字段' $$ JsonObjectMapper'類。 LoganSquare類也將其生成的$$ ObjectMapper類放入一個映射中,映射到新的ConcurrentHashMap ()'中。問題在於'RealmProxy'類沒有自己的'SomethingRealmProxy $$ JsonObjectMapper'來處理像普通的'Something'這樣的類,所以'Map'不包含'JsonObjectMapper'類'SomethingRealmProxy',僅用於'Something'。 –
EpicPandaForce
如果有地方這樣的黑客攻擊可能映射在被硬塞(不帶註釋的代理'@ JsonObject')任何地方,它的使用LoganSquare試圖找到相應的ObjectMapper一次這樣的事實:'類> mapperClass =的Class.forName( cls.getName()+ Constants.MAPPER_CLASS_SUFFIX);'類的後綴是'$$ JsonObjectMapper' – EpicPandaForce