All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.springframework.data.redis.core.DefaultBoundGeoOperations Maven / Gradle / Ivy
/*
* Copyright 2016-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.redis.core;
import java.util.List;
import java.util.Map;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResults;
import org.springframework.data.geo.Metric;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation;
import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs;
/**
* Default implementation of {@link BoundGeoOperations}.
*
* @author Ninad Divadkar
* @author Christoph Strobl
* @author Mark Paluch
* @since 1.8
*/
class DefaultBoundGeoOperations extends DefaultBoundKeyOperations implements BoundGeoOperations {
private final GeoOperations ops;
/**
* Constructs a new {@code DefaultBoundGeoOperations}.
*
* @param key must not be {@literal null}.
* @param operations must not be {@literal null}.
*/
DefaultBoundGeoOperations(K key, RedisOperations operations) {
super(key, operations);
this.ops = operations.opsForGeo();
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#add(org.springframework.data.geo.Point, java.lang.Object)
*/
@Override
public Long add(Point point, M member) {
return ops.add(getKey(), point, member);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#add(org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation)
*/
@Override
public Long add(GeoLocation location) {
return ops.add(getKey(), location);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#add(java.util.Map)
*/
@Override
public Long add(Map memberCoordinateMap) {
return ops.add(getKey(), memberCoordinateMap);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#add(java.lang.Iterable)
*/
@Override
public Long add(Iterable> locations) {
return ops.add(getKey(), locations);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#distance(java.lang.Object, java.lang.Object)
*/
@Override
public Distance distance(M member1, M member2) {
return ops.distance(getKey(), member1, member2);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#distance(java.lang.Object, java.lang.Object, org.springframework.data.geo.Metric)
*/
@Override
public Distance distance(M member1, M member2, Metric unit) {
return ops.distance(getKey(), member1, member2, unit);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#hash(java.lang.Object[])
*/
@Override
public List hash(M... members) {
return ops.hash(getKey(), members);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#position(java.lang.Object[])
*/
@Override
public List position(M... members) {
return ops.position(getKey(), members);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#radius(org.springframework.data.geo.Circle)
*/
@Override
public GeoResults> radius(Circle within) {
return ops.radius(getKey(), within);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#radius(org.springframework.data.geo.Circle, org.springframework.data.redis.core.GeoRadiusCommandArgs)
*/
@Override
public GeoResults> radius(Circle within, GeoRadiusCommandArgs param) {
return ops.radius(getKey(), within, param);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#radius(java.lang.Object, java.lang.Object, double)
*/
@Override
public GeoResults> radius(K key, M member, double radius) {
return ops.radius(getKey(), member, radius);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#radius(java.lang.Object, org.springframework.data.geo.Distance)
*/
@Override
public GeoResults> radius(M member, Distance distance) {
return ops.radius(getKey(), member, distance);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#radius(java.lang.Object, org.springframework.data.geo.Distance, org.springframework.data.redis.core.radiusCommandArgs)
*/
@Override
public GeoResults> radius(M member, Distance distance, GeoRadiusCommandArgs param) {
return ops.radius(getKey(), member, distance, param);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundGeoOperations#remove(java.lang.Object[])
*/
@Override
public Long remove(M... members) {
return ops.remove(getKey(), members);
}
/*
* (non-Javadoc)
* @see org.springframework.data.redis.core.BoundKeyOperations#getType()
*/
@Override
public DataType getType() {
return DataType.ZSET;
}
}