I'm using firebase along with GeoFire, but I'm having trouble figuring out how to deserialize the GeoLocation classes.
My structure is the following: - Root -> User -> Addresses -> Addresses Keys -> GeoLocation
The problem is that GeoLocation does not have a default constructor, only one receiving lat/long coords.
GeoLocation:
public final class GeoLocation {
/** The latitude of this location in the range of [-90, 90] */
public final double latitude;
/** The longitude of this location in the range of [-180, 180] */
public final double longitude;
/**
* Creates a new GeoLocation with the given latitude and longitude.
*
* @throws java.lang.IllegalArgumentException If the coordinates are not valid geo coordinates
* @param latitude The latitude in the range of [-90, 90]
* @param longitude The longitude in the range of [-180, 180]
*/
public GeoLocation(double latitude, double longitude) {
if (!GeoLocation.coordinatesValid(latitude, longitude)) {
throw new IllegalArgumentException("Not a valid geo location: " + latitude + ", " + longitude);
}
this.latitude = latitude;
this.longitude = longitude;
}
Address:
public class Address {
@ParcelPropertyConverter(GeoLocationParcelConverter.class)
GeoLocation geoLocation;
}
And the root class to deserialize:
public class User {
String uid;
String name;
String email;
String profilePic;
String profileBgPic;
String about;
boolean verified;
float rating;
Date birthday;
String gender;
List<Tag> specialities;
HashMap<String, Address> addresses;
I've checked Best way to retrieve/format data using Firebase Java API and Jackson 3rd Party Class With No Default Constructor. But I'm not sure how to make Firebase play along with Jackson to create a deserializer.
The error:
Class com.firebase.geofire.GeoLocation is missing a constructor with no arguments
Thanks