Mapping problem during deserialisation

i am getting error while deserialising to List <candle> in module 6

in module 4 i have changed the function def and return type to list <tiingocandle>

and it passed

but here it says to map to a type of List<candle>

I have a suggestion
you can redefine your objectmapping logic when you are fetching the data from api.
You can map it with TiingoCandle[].class but still can stOre in List

Just open definition and description of Candle class and just see and think why they are emphasizing to use that.

In shorts
If you use object of TiingoCandle for computation, and for application it will be very harmful for system/application. If any system attack happens in your application the person/user can easily manipulate your objects because you have written getter, setters both in that class
E.g. if you’re getting value close=10 from API, using setter it is possible to assign close = 0.

Actually we want this and use TiingoCandle?
No, to overcome from these kind of situations we make reference of interfaces where only getters are present and using concept of inheritance/interfaces in java it is possible to make reference of interfaces(search it on Google how to do that). Now user can only get data from your application and not be able to modify/manipulate because this will limit object manipulation.

2 Likes

To map you have to use List<TiingoCandle> no doubt, but the return type of method is List<Candle> right?
Then you must typecast all the TiingoCandle object to Candle object before returning the List

Hope this helps!

Hi i am having the same problem. How did you solve it?

You can make a TiingoCandle[] and map it into it and then convert it into List afterwards