Network¶
-
public class
Network
implements Serializable, Postable¶ This class stores all the information related to a network. It is fully expanded, meaning that its instance fields like
Network.nearLocation
store expanded objects (i.e.Place
, not the stripped-down forms for database storage.
Methods¶
getDatabaseNetwork¶
-
public DatabaseNetwork
getDatabaseNetwork
()¶ Get a
DatabaseNetwork
with the IDs stored by theNetwork
from which the method is called.Returns: The DatabaseNetwork
associated with thisNetwork
getPostJson¶
-
public JSONObject
getPostJson
()¶ Generate a JSON representation of the object suitable for use in POST requests. Wrapper for
Network.toJSON()
.Throws: - JSONException – May be thrown if something that should be a value in the JSON is not a valid value in the JSON format.
Returns: JSON that can be passed to the server in the body of a POST request
See also:
Network.toJSON();
isLanguageBased¶
-
public boolean
isLanguageBased
()¶ Check whether this network is of people who speak the same language
Returns: true
if the network is defined in terms of language,false
otherwise
isLocationBased¶
-
public boolean
isLocationBased
()¶ Check whether this network is of people who come from the same place
Returns: true
if the network is defined by where members are from,false
otherwise
toJSON¶
-
public JSONObject
toJSON
()¶ Generate a JSON describing the object. The JSON will conform to the following format:
{ "id_city_cur": 0, "city_cur": "string", "id_region_cur": 0, "region_cur": "string", "id_country_cur": 0, "country_cur": "string", "id_city_origin": 0, "city_origin": "string", "id_region_origin": 0, "region_origin": "string", "id_country_origin": 0, "country_origin": "string", "id_language_origin": 0, "language_origin": "string", "network_class": "string" }
where missing IDs are passed as
Location.NOWHERE
. This format is suitable for submission to the server using the/network/new
POST endpoint.Throws: - JSONException – Unclear when this would be thrown
Returns: JSON representation of the object