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 to
Value.- Since:
- 6.1
- Author:
- Mark Paluch
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description protectedGeoValue()Serializable constructor. -
Method Summary
Modifier and Type Method Description booleanequals(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)GeoCoordinatesgetCoordinates()doublegetLatitude()doublegetLongitude()inthashCode()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 aGeoValueconsisting of the results of applying the given function to the value of this element.GeoValue<V>mapCoordinates(Function<? super GeoCoordinates,? extends GeoCoordinates> mapper)Returns aGeoValueconsisting of the results of applying the given function to theGeoCoordinatesof this element.StringtoString()Methods inherited from class io.lettuce.core.Value
empty, from, fromNullable, getValue, getValueOrElse, getValueOrElseGet, getValueOrElseThrow, hasValue, ifEmpty, ifHasValue, ifHasValueOrElse, isEmpty, just, optional, stream
-
Constructor Details
-
GeoValue
protected GeoValue()Serializable constructor.
-
-
Method Details
-
from
Creates aValuefrom akeyand anOptional. The resulting value contains the value from theOptionalif a value is present. Value is empty if theOptionalis empty.- Parameters:
coordinates- the score.optional- the optional. May be empty but nevernull.- Returns:
- the
Value.
-
fromNullable
Creates aValuefrom acoordinatesandvalue. The resulting value contains the value if thevalueis not null.- Parameters:
coordinates- the coordinates.value- the value. May benull.- Returns:
- the
Value.
-
just
- 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
- Parameters:
coordinates- the coordinates.value- the value. Must not benull.- Returns:
- the
GeoValue.
-
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.
-
equals
-
hashCode
public int hashCode() -
toString
-
map
Returns aGeoValueconsisting 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 aGeoValueconsisting of the results of applying the given function to theGeoCoordinatesof this element. Mapping is performed only if avalue is present.- Parameters:
mapper- a stateless function to apply to each element.- Returns:
- the new
GeoValue.
-