B
B
bropa2017-10-11 15:44:08
Java
bropa, 2017-10-11 15:44:08

Java Android Retrofit inheritance problem?

Dear gurus, tell the newbie how to solve the problem.
I receive different object models in response to different requests to the server as a retrofit. all objects in the same view (string) store the date of the meeting, the other fields are different. I drive the collection that I get into a method that parses the date string in the way I need and writes it to the custom fields I need.
Because the date string is always the same. How to make it so that there is one method for all answers, respectively, and different models. The problem is what I was trying to do through inheritance. Declared the superclass from which it inherited. But in this case, the retrofit praser crashes with the error "Unable to create converter for class"
I tried to add the necessary methods to the body of the setter in each response class, like I parse the string and stuff the values ​​\u200b\u200bthat I need. But the seter is not called on response. There is no access to the server. Service is not mine
How to make beautiful?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2017-10-11
@aol-nnov

and where about inheritance? the fact that the classes have the same field does not give grounds for such high-profile statements.
how to do? for each answer its essence.

O
Oleg Gamega, 2017-10-11
@gadfi

How to make beautiful?
don't know but effective www.jsonschema2pojo.org

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question