Network¶
-
public class
Networkimplements Serializable, Postable¶ This class stores all the information related to a network. It is fully expanded, meaning that its instance fields like
Network.nearLocationstore expanded objects (i.e.Place, not the stripped-down forms for database storage.
Methods¶
getDatabaseNetwork¶
-
public DatabaseNetwork
getDatabaseNetwork()¶ Get a
DatabaseNetworkwith the IDs stored by theNetworkfrom which the method is called.Returns: The DatabaseNetworkassociated 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: trueif the network is defined in terms of language,falseotherwise
isLocationBased¶
-
public boolean
isLocationBased()¶ Check whether this network is of people who come from the same place
Returns: trueif the network is defined by where members are from,falseotherwise
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/newPOST endpoint.Throws: - JSONException – Unclear when this would be thrown
Returns: JSON representation of the object