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

redis.clients.jedis.search.aggr.Row Maven / Gradle / Ivy

The newest version!
package redis.clients.jedis.search.aggr;

import java.util.Map;
import redis.clients.jedis.util.DoublePrecision;

public class Row {

  private final Map fields;

  public Row(Map fields) {
    this.fields = fields;
  }

  public boolean containsKey(String key) {
    return fields.containsKey(key);
  }

  public Object get(String key) {
    return fields.get(key);
  }

  public String getString(String key) {
    if (!containsKey(key)) {
      return "";
    }
    return (String) fields.get(key);
  }

  public long getLong(String key) {
    if (!containsKey(key)) {
      return 0;
    }
    return Long.parseLong((String) fields.get(key));
  }

  public double getDouble(String key) {
    if (!containsKey(key)) {
      return 0;
    }
    return DoublePrecision.parseFloatingPointNumber((String) fields.get(key));
  }

  @Override
  public String toString() {
    return String.valueOf(fields);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy