com.factual.driver
Class Response

java.lang.Object
  extended by com.factual.driver.Response
Direct Known Subclasses:
CrosswalkResponse, ReadResponse, SchemaResponse

public abstract class Response
extends Object

Represents the basic concept of a response from Factual.

Author:
aaron

Field Summary
static int UNDEFINED
           
 
Constructor Summary
Response()
           
 
Method Summary
 int getIncludedRowCount()
           
abstract  String getJson()
          Subclasses of Response must provide access to the original JSON representation of Factual's response.
 String getStatus()
          The status returned by the Factual API server, e.g.
 int getTotalRowCount()
           
 String getVersion()
          The version tag returned by the Factual API server, e.g.
 boolean isEmpty()
           
 String toString()
           
static void withMeta(Response resp, org.json.JSONObject rootJsonObj)
          Parses response metadata from rootJsonObj and adds it to response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
See Also:
Constant Field Values
Constructor Detail

Response

public Response()
Method Detail

getStatus

public String getStatus()
The status returned by the Factual API server, e.g. "ok".

Returns:
status returned by the Factual API server.

getVersion

public String getVersion()
The version tag returned by the Factual API server, e.g. "3".

Returns:
the version tag returned by the Factual API server.

getTotalRowCount

public int getTotalRowCount()
Returns:
total underlying row count, or UNDEFINED if unknown.

getIncludedRowCount

public int getIncludedRowCount()
Returns:
amount of result rows returned in this response.

isEmpty

public boolean isEmpty()
Returns:
true if Factual's response did not include any results records for the query, false otherwise.

withMeta

public static void withMeta(Response resp,
                            org.json.JSONObject rootJsonObj)
Parses response metadata from rootJsonObj and adds it to response

Parameters:
response - the response object to which to add metadata.
rootJsonObj - the top-level JSON response Object built from a Factual response.

toString

public String toString()
Overrides:
toString in class Object

getJson

public abstract String getJson()
Subclasses of Response must provide access to the original JSON representation of Factual's response.

Returns:
the original JSON representation of Factual's response.


Copyright © 2012. All Rights Reserved.