@SuppressWarnings("rawtypes") private boolean isEqualsJsonObject(JSONObject a, JSONObject b) { if (policy == STRICT) { if (a.length() != b.length()) { return false; } } if (policy == SIMPLE) { if (a.length() > b.length()) { return false; } } Enumeration keys = a.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (!b.has(key)) { return false; } try { if (!isEquals(a.get(key), b.get(key))) { return false; } } catch (JSONException e) { return false; } } return true; }
public static Facturas fromJson(String jsonText) { Facturas facs = new Facturas(); try { JSONObject json = new JSONObject(jsonText); if (json.has("id")) { facs.setId(json.getString("id")); } if (json.has("invoice_number")) { facs.setInvoiceNumber(json.getString("invoice_number")); } if (json.has("amount")) { facs.setAmount(json.getString("amount")); } if (json.has("nit")) { facs.setNit(json.getString("nit")); } if (json.has("name")) { facs.setName(json.getString("name")); } } catch (JSONException e) { } return facs; }
public boolean hasAuthenticationErrorOn(String key) { return mAuthenticationErrors != null && mAuthenticationErrors.has(key); }