com.sunlightlabs.entities
Class District

java.lang.Object
  extended by com.sunlightlabs.entities.JSONEntity
      extended by com.sunlightlabs.entities.District

public class District
extends JSONEntity

represents a Legislative (?or Congressional) district com.sunlightlabs.entities.District steve Jul 22, 2009


Field Summary
static District[] EMPTY_ARRAY
           
static java.lang.String[] KNOWN_PROPERTIES
           
static java.lang.String name
           
static java.lang.Class<District> THIS_CLASS
           
 
Constructor Summary
District(JSONObject data)
          constructor
District(java.util.Map data)
          constructor
 
Method Summary
static District[] allDistricts(com.sunlightlabs.api.ApiCall call)
           
static District getDistrictFromLatLon(com.sunlightlabs.api.ApiCall call, java.lang.String lat, java.lang.String lon)
          read a district from a lat lon
static District[] getDistrictsForZipCode(com.sunlightlabs.api.ApiCall call, java.lang.String zipcode)
          get all districts in a zip code ( usually one)
 java.lang.String getEntityName()
          JSON Tag for this
 java.lang.String[] getKnownProperties()
          unofficial list of properties
 java.lang.String getName()
           
static java.lang.String getPluralEntityName()
           
static java.lang.String[] getZipsFromDistricts(com.sunlightlabs.api.ApiCall call, java.lang.String state, java.lang.String district)
          return all zip codes in the district
 
Methods inherited from class com.sunlightlabs.entities.JSONEntity
equivalent, getAllKeys, getArrayItems, getArrayStringItems, getContainedJSONObject, getJSONObject, getJSONObjects, getJSONStrings, getNameValuePairs, getProperties, getProperty, show, show, showProperties, showProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THIS_CLASS

public static java.lang.Class<District> THIS_CLASS

EMPTY_ARRAY

public static District[] EMPTY_ARRAY

KNOWN_PROPERTIES

public static final java.lang.String[] KNOWN_PROPERTIES

name

public static final java.lang.String name
See Also:
Constant Field Values
Constructor Detail

District

public District(JSONObject data)
constructor

Parameters:
data - non-nulljson object with properties

District

public District(java.util.Map data)
constructor

Parameters:
data - non-null map with properties
Method Detail

getPluralEntityName

public static java.lang.String getPluralEntityName()

allDistricts

public static District[] allDistricts(com.sunlightlabs.api.ApiCall call)
Parameters:
call - call non-null api caller
Returns:
non-null array of districts

getDistrictsForZipCode

public static District[] getDistrictsForZipCode(com.sunlightlabs.api.ApiCall call,
                                                java.lang.String zipcode)
get all districts in a zip code ( usually one)

Parameters:
call - call non-null api caller
zipcode - non-null zip code
Returns:
non-null array of districts

getZipsFromDistricts

public static java.lang.String[] getZipsFromDistricts(com.sunlightlabs.api.ApiCall call,
                                                      java.lang.String state,
                                                      java.lang.String district)
return all zip codes in the district

Parameters:
call - call non-null api caller
state - non-null existing state
district - non-null existing district number
Returns:
non-null possibly empty array of zip codes

getDistrictFromLatLon

public static District getDistrictFromLatLon(com.sunlightlabs.api.ApiCall call,
                                             java.lang.String lat,
                                             java.lang.String lon)
read a district from a lat lon

Parameters:
call - non-null api caller
lat - district latitude as a decimal string i.e "47.67898"
lon - district longitude as a decimal string i.e "-121.67453"
Returns:
possibly null district

getEntityName

public java.lang.String getEntityName()
JSON Tag for this

Specified by:
getEntityName in class JSONEntity
Returns:
non-null String

getKnownProperties

public java.lang.String[] getKnownProperties()
unofficial list of properties

Specified by:
getKnownProperties in class JSONEntity

getName

public java.lang.String getName()