public T clear() { objectId = null; createdAt = -1; updatedAt = -1; isComplete = false; serverData.clear(); availableKeys.clear(); return self(); }
public T put(String key, Object value) { serverData.put(key, value); availableKeys.add(key); return self(); }
public T createdAt(Date createdAt) { this.createdAt = createdAt.getTime(); return self(); }
/** * Applies a {@code State} on top of this {@code Builder} instance. * * @param other The {@code State} to apply over this instance. * @return A new {@code Builder} instance. */ public T apply(State other) { if (other.objectId() != null) { objectId(other.objectId()); } if (other.createdAt() > 0) { createdAt(other.createdAt()); } if (other.updatedAt() > 0) { updatedAt(other.updatedAt()); } isComplete(isComplete || other.isComplete()); for (String key : other.keySet()) { put(key, other.get(key)); } availableKeys(other.availableKeys()); return self(); }
public T apply(ParseOperationSet operations) { for (String key : operations.keySet()) { ParseFieldOperation operation = operations.get(key); Object oldValue = serverData.get(key); Object newValue = operation.apply(oldValue, key); if (newValue != null) { put(key, newValue); } else { remove(key); } } return self(); } }
public T updatedAt(Date updatedAt) { this.updatedAt = updatedAt.getTime(); return self(); }
public T objectId(String objectId) { this.objectId = objectId; return self(); }
public T remove(String key) { serverData.remove(key); return self(); }
public T createdAt(long createdAt) { this.createdAt = createdAt; return self(); }
public T availableKeys(Collection<String> keys) { availableKeys.addAll(keys); return self(); }
public T isComplete(boolean complete) { isComplete = complete; return self(); }
public T updatedAt(long updatedAt) { this.updatedAt = updatedAt; return self(); }