/** * Sets the installationId and persists it to disk. */ public void set(String newInstallationId) { synchronized (lock) { if (ParseTextUtils.isEmpty(newInstallationId) || newInstallationId.equals(get())) { return; } setInternal(newInstallationId); } }
/** * Method used by parse server webhooks implementation to convert raw JSON to Parse Object * <p> * Method is used by parse server webhooks implementation to create a * new {@code ParseObject} from the incoming json payload. The method is different from * {@link #fromJSON(JSONObject, String, ParseDecoder, Set)} ()} in that it calls * {@link #build(JSONObject, ParseDecoder)} which populates operation queue * rather then the server data from the incoming JSON, as at external server the incoming * JSON may not represent the actual server data. Also it handles * {@link ParseFieldOperations} separately. * * @param json The object's data. * @param decoder Delegate for knowing how to decode the values in the JSON. */ static <T extends ParseObject> T fromJSONPayload( JSONObject json, ParseDecoder decoder) { String className = json.optString(KEY_CLASS_NAME); if (className == null || ParseTextUtils.isEmpty(className)) { return null; } String objectId = json.optString(KEY_OBJECT_ID, null); @SuppressWarnings("unchecked") T object = (T) ParseObject.createWithoutData(className, objectId); object.build(json, decoder); return object; }
@Test public void testStringIsNotEmpty() { assertFalse(ParseTextUtils.isEmpty("not empty")); }
@Test public void testEmptyStringIsEmpty() { assertTrue(ParseTextUtils.isEmpty("")); }
@Test public void testNullStringIsEmpty() { assertTrue(ParseTextUtils.isEmpty(null)); }
synchronized (mutex) { final String sessionToken = user != null ? user.getSessionToken() : null; if (ParseTextUtils.isEmpty(getUsername())) { return Task.forError(new IllegalArgumentException("Username cannot be missing or blank")); if (ParseTextUtils.isEmpty(getPassword())) { return Task.forError(new IllegalArgumentException("Password cannot be missing or blank"));