Back to project page worldwondersproject.
The source code is released under:
MIT License
If you think the Android project worldwondersproject listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ciandt.cursoandroid.worldwondersapp.entity; /*from w ww . j a v a 2 s .com*/ import org.json.JSONException; import org.json.JSONObject; public abstract class BaseEntity { protected String getString(JSONObject jsonObject, String objectName) { String result = ""; if (this.objectContainsEntry(jsonObject, objectName)) { try { if (!jsonObject.isNull(objectName)) { result = jsonObject.getString(objectName); } } catch (JSONException e) { e.printStackTrace(); } } return result; } protected Integer getInteger(JSONObject jsonObject, String objectName) { Integer result = null; if (this.objectContainsEntry(jsonObject, objectName)) { try { if (!jsonObject.isNull(objectName)) { result = jsonObject.getInt(objectName); } } catch (JSONException e) { e.printStackTrace(); } } return result; } protected Boolean objectContainsEntry(JSONObject jsonObject, String objectName) { Boolean result = false; if (jsonObject != null && jsonObject.has(objectName)) { result = true; } return result; } }