I try to parse a List of EventPojo
-classes from a firebase DB like this:
GenericTypeIndicator<HashMap<String, EventPojo>> tEvents = new GenericTypeIndicator<HashMap<String, EventPojo>>() {};
HashMap<String, EventPojo> events = dataSnapshot.child(getString(R.string.eventsNodeName)).getValue(tEvents);
In EventPojo
I have a GregorianCalender
:
public class EventPojo implements Comparable<EventPojo>{
GregorianCalendar date;
...
When I try to get the HashMap from the DB, I get an InstantiationException
:
java.lang.RuntimeException: java.lang.InstantiationException: Can't instantiate abstract class java.util.TimeZone
Why is firebase trying to instatiate TimeZone
and not GregorianCalender
?