base.jee.api.model.Location Maven / Gradle / Ivy
package base.jee.api.model;
import base.QueryResult;
import base.json.Json;
public class Location implements QueryResult {
private long id;
private String country;
private String city;
private double latitude;
private double longitude;
public Location(long id, String country, String city, double latitude, double longitude) {
this.id = id;
this.country = country;
this.city = city;
this.latitude = latitude;
this.longitude = longitude;
}
public long getId() {
return id;
}
public String getCountry() {
return country;
}
public String getCity() {
return city;
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public String toString() {
return toJson();
}
public String toJson() {
StringBuffer b = new StringBuffer();
b.append("{\"id\":");
b.append(id);
if(country != null) {
b.append(",\"country\":\"");
b.append(Json.escape(country));
b.append("\"");
}
if(city != null) {
b.append(",\"city\":\"");
b.append(Json.escape(city));
b.append("\"");
}
b.append("}");
return b.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy