Skip to content

Instantly share code, notes, and snippets.

@ishmaelmakitla
Last active April 25, 2016 08:39
Show Gist options
  • Save ishmaelmakitla/d64dc74e9e87e81701bd975f06cf0682 to your computer and use it in GitHub Desktop.
Save ishmaelmakitla/d64dc74e9e87e81701bd975f06cf0682 to your computer and use it in GitHub Desktop.
package <your-package-name>
import com.google.gson.Gson;
public class LastKnownUserPosition {
private double latitude;
private double longitude;
public LastKnownUserPosition(){
}
public LastKnownUserPosition(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
@Override
public String toString() {
return (new Gson()).toJson(this, LastKnownUserPosition.class);
}
/**
* Utility method for converting a traffic-light JSON string to TrafficLight object
* @param trafficLightJSON
* @return
*/
public static LastKnownUserPosition asLastKnownUserPosition(String locationtJSON){
return (new Gson()).fromJson(locationtJSON, LastKnownUserPosition.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment