Package io.lettuce.core
Class GeoValue<V>
- java.lang.Object
-
- io.lettuce.core.Value<V>
-
- io.lettuce.core.GeoValue<V>
-
- Type Parameters:
V
- Value type.
- All Implemented Interfaces:
Serializable
public class GeoValue<V> extends Value<V>
A Geo value extension toValue
.- Since:
- 6.1
- Author:
- Mark Paluch
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GeoValue()
Serializable constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static <T extends V,V>
Value<V>from(GeoCoordinates coordinates, Optional<T> optional)
static <T extends V,V>
Value<V>fromNullable(GeoCoordinates coordinates, T value)
GeoCoordinates
getCoordinates()
double
getLatitude()
double
getLongitude()
int
hashCode()
static <T extends V,V>
GeoValue<V>just(double longitude, double latitude, T value)
static <T extends V,V>
GeoValue<V>just(GeoCoordinates coordinates, T value)
<R> GeoValue<R>
map(Function<? super V,? extends R> mapper)
Returns aGeoValue
consisting of the results of applying the given function to the value of this element.GeoValue<V>
mapCoordinates(Function<? super GeoCoordinates,? extends GeoCoordinates> mapper)
Returns aGeoValue
consisting of the results of applying the given function to theGeoCoordinates
of this element.String
toString()
-
Methods inherited from class io.lettuce.core.Value
empty, from, fromNullable, getValue, getValueOrElse, getValueOrElseGet, getValueOrElseThrow, hasValue, ifEmpty, ifHasValue, ifHasValueOrElse, isEmpty, just, optional, stream
-
-
-
-
Method Detail
-
from
public static <T extends V,V> Value<V> from(GeoCoordinates coordinates, Optional<T> optional)
Creates aValue
from akey
and anOptional
. The resulting value contains the value from theOptional
if a value is present. Value is empty if theOptional
is empty.- Parameters:
coordinates
- the score.optional
- the optional. May be empty but nevernull
.- Returns:
- the
Value
.
-
fromNullable
public static <T extends V,V> Value<V> fromNullable(GeoCoordinates coordinates, T value)
Creates aValue
from acoordinates
andvalue
. The resulting value contains the value if thevalue
is not null.- Parameters:
coordinates
- the coordinates.value
- the value. May benull
.- Returns:
- the
Value
.
-
just
public static <T extends V,V> GeoValue<V> just(double longitude, double latitude, T value)
- Parameters:
longitude
- the longitude coordinate according to WGS84.latitude
- the latitude coordinate according to WGS84.value
- the value. Must not benull
.- Returns:
- the
GeoValue
-
just
public static <T extends V,V> GeoValue<V> just(GeoCoordinates coordinates, T value)
- Parameters:
coordinates
- the coordinates.value
- the value. Must not benull
.- Returns:
- the
GeoValue
.
-
getCoordinates
public GeoCoordinates getCoordinates()
-
getLongitude
public double getLongitude()
- Returns:
- the longitude if this instance has a
Value.hasValue()
. - Throws:
NoSuchElementException
- if the value is not present.
-
getLatitude
public double getLatitude()
- Returns:
- the latitude if this instance has a
Value.hasValue()
. - Throws:
NoSuchElementException
- if the value is not present.
-
map
public <R> GeoValue<R> map(Function<? super V,? extends R> mapper)
Returns aGeoValue
consisting of the results of applying the given function to the value of this element. Mapping is performed only if avalue is present
.
-
mapCoordinates
public GeoValue<V> mapCoordinates(Function<? super GeoCoordinates,? extends GeoCoordinates> mapper)
Returns aGeoValue
consisting of the results of applying the given function to theGeoCoordinates
of this element. Mapping is performed only if avalue is present
.- Parameters:
mapper
- a stateless function to apply to each element.- Returns:
- the new
GeoValue
.
-
-