All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.redisearch.client.util.ClientUtil Maven / Gradle / Ivy

The newest version!
package io.redisearch.client.util;

import java.util.HashMap;
import java.util.Map;

public class ClientUtil {

  public static Map toStringMap(Map input) {
    Map output = new HashMap<>(input.size());
    for (Map.Entry entry : input.entrySet()) {
      String key = entry.getKey();
      Object obj = entry.getValue();
      String str;
      if (obj instanceof redis.clients.jedis.GeoCoordinate) {
        redis.clients.jedis.GeoCoordinate geo = (redis.clients.jedis.GeoCoordinate) obj;
        str = geo.getLongitude() + "," + geo.getLatitude();
      } else if (obj instanceof String) {
        str = (String) obj;
      } else {
        str = obj.toString();
      }
      output.put(key, str);
    }
    return output;
  }

  private ClientUtil() {
    throw new InstantiationError("Must not instantiate this class");
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy