com.factual.driver
Class ReadResponse

java.lang.Object
  extended by com.factual.driver.Response
      extended by com.factual.driver.ReadResponse
All Implemented Interfaces:
Tabular

public class ReadResponse
extends Response
implements Tabular

Represents the response from running a fetch request against Factual, such as a geolocation based query for specific places entities.

Author:
aaron

Field Summary
 
Fields inherited from class com.factual.driver.Response
UNDEFINED
 
Constructor Summary
ReadResponse(String json)
          Constructor, parses from a JSON response String.
 
Method Summary
 Map<String,Object> first()
           
 List<Map<String,Object>> getData()
          An ordered collection of the main data returned by Factual.
 String getJson()
          Subclasses of Response must provide access to the original JSON representation of Factual's response.
 Collection<String> mapStrings(String field)
           
 int size()
           
 
Methods inherited from class com.factual.driver.Response
getIncludedRowCount, getStatus, getTotalRowCount, getVersion, isEmpty, toString, withMeta
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadResponse

public ReadResponse(String json)
Constructor, parses from a JSON response String.

Parameters:
json - the JSON response String returned by Factual.
Method Detail

getJson

public String getJson()
Description copied from class: Response
Subclasses of Response must provide access to the original JSON representation of Factual's response.

Specified by:
getJson in class Response
Returns:
The full JSON response from Factual

first

public Map<String,Object> first()
Returns:
the first data record or null if no data was returned.

getData

public List<Map<String,Object>> getData()
An ordered collection of the main data returned by Factual. Represented as Maps, where each Map is a record in the results.

Specified by:
getData in interface Tabular
Returns:
the main data returned by Factual.

size

public int size()
Returns:
the size of the result set

mapStrings

public Collection<String> mapStrings(String field)
Returns:
a Collection of all String values found in this Response's data rows as the field attribute.


Copyright © 2012. All Rights Reserved.