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

com.redislabs.redisgraph.impl.RecordImpl Maven / Gradle / Ivy

There is a newer version: 2.6.0-rc3
Show newest version
package com.redislabs.redisgraph.impl;

import java.util.List;

import com.redislabs.redisgraph.Record;

public class RecordImpl implements Record {

  private final List header;
  private final List values;

  RecordImpl(List header, List values){
    this.header=header;
    this.values = values;
  }

  @Override
  public  T getValue(int index) {
    return (T)this.values.get(index);
  }

  @Override
  public  T getValue(String key) {
    return getValue(this.header.indexOf(key));
  }

  @Override
  public String getString(int index) {
    return this.values.get(index).toString();
  }

  @Override
  public String getString(String key) {
    return getString(this.header.indexOf(key));
  }

  @Override
  public List keys() {
    return header;
  }

  @Override
  public List values() {
    return this.values;
  }

  @Override
  public boolean containsKey(String key) {
    return this.header.contains(key);
  }

  @Override
  public int size() {
    return this.header.size();
  }

  @Override
  public String toString() {
    return this.values.toString();
  }


}