Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.factual.driver;
 
 import java.util.Map;
 
 import  org.json.JSONException;
 import  org.json.JSONObject;

Represents the response from running a Facet lookup against Factual.

Author(s):
brandon
public class FacetResponse extends Response {
	private String json = null;
	private Map<StringMap<StringObject>> data = null;

Constructor, parses from a JSON response String.

Parameters:
json the JSON response String returned by Factual.
	public FacetResponse(String json) {
		this. = json;
		try {
			JSONObject rootJsonObj = new JSONObject(json);
			Response.withMeta(thisrootJsonObj);
			parseResponse(rootJsonObj.getJSONObject(.));
catch (JSONException e) {
			throw new RuntimeException(e);
		}
	}
	private void parseResponse(JSONObject jothrows JSONException {
	     = JsonUtil.data(jo.getJSONObject(.));
	}

    
An collection of the facet data returned by Factual. Represented as a nested mapping from field name to facet to count.

Returns:
the facet data returned by Factual.
	public Map<StringMap<StringObject>> getData() {
		return ;
	}
	public String getJson() {
		return ;
	}
New to GrepCode? Check out our FAQ X