I'm building an android app that saves info on incoming/outgoing calls in a CallLog class, incoming/outgoing SMSes in an SmsLog class, and bytes sent/received via a DataLog class. I made them all implement a JsonLog interface so I can create a single ArrayList of JsonLogs, hoping that it will be easily convertible to a JSON array of different objects via Jackson.
However, I kept getting this error whenever I'm deserializing the JSON file:
com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance
of com.project.pojos.JsonLog, problem: abstract types either need to be mapped
to concrete types, have custom deserializer, or be instantiated with additional
type information
How can I solve this? All JsonLog classes have a string attribute type, which is either in_call or out_call for CallLogs, in_sms or out_sms for SmsLogs, and data for DataLog.