private void verifyState() { if (null == subscriptionId || subscriptionId.length() < 1) { throw new IllegalArgumentException("subscriptionId is required"); } if (null == owner || owner.getId().length() < 1) { throw new IllegalArgumentException("owner is required"); } }
public UpdatedResource(JSONObject json) { try { this.subscriptionId = json.getString("subscriptionId"); this.owner = FitbitResourceOwner.fromJson(json); if (json.has("collectionType")) { this.collectionType = APICollectionType.valueOf(json.getString("collectionType")); } if (json.has("date")) { this.date = APIUtil.parseDate(json.getString("date")); } } catch (JSONException e) { throw new IllegalArgumentException( "Given JSON object does not contain all required elements.", e); } verifyState(); }