private void setState(State newState, boolean notifyIfObjectIdChanges) { synchronized (mutex) { String oldObjectId = state.objectId(); String newObjectId = newState.objectId(); state = newState; if (notifyIfObjectIdChanges && !ParseTextUtils.equals(oldObjectId, newObjectId)) { notifyObjectIdChanged(oldObjectId, newObjectId); } rebuildEstimatedData(); } }
@Test public void testEqualsNull() { assertTrue(ParseTextUtils.equals(null, null)); }
@Test public void testNotEqualsString() { assertFalse(ParseTextUtils.equals("grantland", "nlutsenko")); }
/** * Setter for the object id. In general you do not need to use this. However, in some cases this * can be convenient. For example, if you are serializing a {@code ParseObject} yourself and wish * to recreate it, you can use this to recreate the {@code ParseObject} exactly. */ public void setObjectId(String newObjectId) { synchronized (mutex) { String oldObjectId = state.objectId(); if (ParseTextUtils.equals(oldObjectId, newObjectId)) { return; } // We don't need to use setState since it doesn't affect our cached state. state = state.newBuilder().objectId(newObjectId).build(); notifyObjectIdChanged(oldObjectId, newObjectId); } }