com.redis.spring.batch.common.ToGeoValueFunction Maven / Gradle / Ivy
The newest version!
package com.redis.spring.batch.common;
import java.util.function.Function;
import java.util.function.ToDoubleFunction;
import io.lettuce.core.GeoValue;
public class ToGeoValueFunction implements Function> {
private final Function memberConverter;
private final ToDoubleFunction longitudeConverter;
private final ToDoubleFunction latitudeConverter;
public ToGeoValueFunction(Function member, ToDoubleFunction longitude, ToDoubleFunction latitude) {
this.memberConverter = member;
this.longitudeConverter = longitude;
this.latitudeConverter = latitude;
}
@Override
public GeoValue apply(T t) {
double longitude = this.longitudeConverter.applyAsDouble(t);
double latitude = this.latitudeConverter.applyAsDouble(t);
return GeoValue.just(longitude, latitude, memberConverter.apply(t));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy