io.quarkus.redis.datasource.geo.GeoValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.datasource.geo;
import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalLong;
/**
* Represents a value returned from {@code GEO} commands.
* The fields may not be populated. It depends on the {@code GEO} commands parameters
*
* @param the member type
*/
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public class GeoValue {
public final V member;
public final OptionalDouble distance;
public final OptionalLong geohash;
public final OptionalDouble longitude;
public final OptionalDouble latitude;
public GeoValue(V member, OptionalDouble distance, OptionalLong geohash, OptionalDouble longitude,
OptionalDouble latitude) {
this.member = member;
this.distance = distance;
this.geohash = geohash;
this.longitude = longitude;
this.latitude = latitude;
}
public V member() {
return member;
}
public OptionalDouble distance() {
return distance;
}
public OptionalLong geohash() {
return geohash;
}
public OptionalDouble longitude() {
return longitude;
}
public OptionalDouble latitude() {
return latitude;
}
public Optional position() {
if (longitude.isPresent() && latitude.isPresent()) {
return Optional.of(GeoPosition.of(longitude.getAsDouble(), latitude.getAsDouble()));
}
return Optional.empty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy