Package com.couchbase.client.java.util
Class Coordinate
java.lang.Object
com.couchbase.client.java.util.Coordinate
A coordinate is a tuple of a latitude and a longitude.
To create a new instance:
Coordinate eiffelTower = Coordinate.lat(48.858093).lon(2.294694);Or, if you prefer to specify longitude first:
Coordinate eiffelTower = Coordinate.lon(2.294694).lat(48.858093);
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A staged builder that holds a coordinate's latitude value.static final class
A staged builder that holds a coordinate's longitude value. -
Method Summary
Modifier and TypeMethodDescriptiondouble
lat()
Returns the latitude of this coordinate.lat
(double lat) Returns a new staged Coordinate builder, with the specified latitude value.double
lon()
Returns the longitude of this coordinate.lon
(double lon) Returns a new staged Coordinate builder, with the specified longitude value.static Coordinate
ofLonLat
(double lon, double lat) Creates a newCoordinate
with a longitude and a latitude.toString()
-
Method Details
-
ofLonLat
Creates a newCoordinate
with a longitude and a latitude.To avoid confusing the order of the longitude and latitude parameters, please use
lat(double)
orlon(double)
instead.- Parameters:
lon
- the longitude of the coordinate.lat
- the latitude of the coordinate.- Returns:
- a new
Coordinate
.
-
lon
public double lon()Returns the longitude of this coordinate. -
lat
public double lat()Returns the latitude of this coordinate. -
lat
Returns a new staged Coordinate builder, with the specified latitude value.Complete the Coordinate by calling
Coordinate.CoordinateBuilderLatitude.lon(double)
on the result. Example usage:Coordinate eiffelTower = Coordinate.lat(48.858093).lon(2.294694);
-
lon
Returns a new staged Coordinate builder, with the specified longitude value.Complete the Coordinate by calling
Coordinate.CoordinateBuilderLongitude.lat(double)
on the result. Example usage:Coordinate eiffelTower = Coordinate.lon(2.294694).lat(48.858093);
-
toString
-