Last active
April 25, 2016 08:39
-
-
Save ishmaelmakitla/d64dc74e9e87e81701bd975f06cf0682 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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