本文整理汇总了Java中org.mozilla.gecko.sync.ExtendedJSONObject.remove方法的典型用法代码示例。如果您正苦于以下问题:Java ExtendedJSONObject.remove方法的具体用法?Java ExtendedJSONObject.remove怎么用?Java ExtendedJSONObject.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mozilla.gecko.sync.ExtendedJSONObject
的用法示例。
在下文中一共展示了ExtendedJSONObject.remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decrementObsoleteId
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
protected void decrementObsoleteId(ExtendedJSONObject ids, String id) {
if (!ids.containsKey(id)) {
return;
}
try {
Long attempts = ids.getLong(id);
if (attempts == null || --attempts < 1) {
ids.remove(id);
} else {
ids.put(id, attempts);
}
} catch (ClassCastException e) {
ids.remove(id);
Logger.info(LOG_TAG, "Got exception decrementing obsolete ids counter.", e);
}
}
示例2: purgeObsoleteIds
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
public void purgeObsoleteIds(Collection<String> oldIds) {
ExtendedJSONObject ids = getObsoleteIds();
for (String oldId : oldIds) {
ids.remove(oldId);
}
setObsoleteIds(ids);
}
示例3: addObsoleteId
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
/**
* Track the given document ID for eventual obsolescence and deletion.
* Obsolete IDs are not known to have been uploaded to the server, so we just
* give a best effort attempt at deleting them
*
* @param id to eventually delete.
*/
public void addObsoleteId(String id) {
ExtendedJSONObject ids = getObsoleteIds();
if (ids.size() >= HealthReportConstants.MAXIMUM_STORED_OBSOLETE_DOCUMENT_IDS) {
// Remove the one that's been tried the most and is least likely to be
// known to be on the server. Since the comparator orders in decreasing
// order, we take the max.
ids.remove(Collections.max(ids.entrySet(), new PairComparator()).getKey());
}
ids.put(id, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID);
setObsoleteIds(ids);
}
示例4: fromCursorRow
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
/**
* TODO: optionally produce a partial record by examining SYNC_CHANGE_FLAGS/SYNC_STATUS.
*/
public ClientReadingListRecord fromCursorRow() {
final ExtendedJSONObject object = new ExtendedJSONObject();
for (int i = 0; i < this.fields.length; ++i) {
final String field = fields[i];
if (field == null) {
continue;
}
final int column = this.columns[i];
if (Versions.feature11Plus) {
fillHoneycomb(object, this.cursor, field, column);
} else {
fillGingerbread(object, this.cursor, field, column);
}
}
// Apply cross-field constraints.
if (object.containsKey("unread") && object.getBoolean("unread")) {
object.remove("marked_read_by");
object.remove("marked_read_on");
}
// Construct server metadata and client metadata from the object.
final long serverLastModified = object.getLong("last_modified", -1L);
final String guid = object.containsKey("guid") ? object.getString("guid") : null;
final ServerMetadata sm = new ServerMetadata(guid, serverLastModified);
final long clientLastModified = object.getLong("client_last_modified", -1L);
// This has already been translated...
final boolean isArchived = object.getBoolean("archived");
// ... but this is a client-only field, so it needs to be converted.
final boolean isDeleted = object.getLong("is_deleted", 0L) == 1L;
final long localID = object.getLong("_id", -1L);
final ClientMetadata cm = new ClientMetadata(localID, clientLastModified, isDeleted, isArchived);
// Remove things that aren't part of the spec.
object.remove("last_modified");
object.remove("guid");
object.remove("client_last_modified");
object.remove("is_deleted");
// We never want to upload stored_on; for new items it'll be null (and cause Bug 1153358),
// and for existing items it should never change.
object.remove("stored_on");
object.remove(ReadingListItems.CONTENT_STATUS);
object.remove(ReadingListItems.SYNC_STATUS);
object.remove(ReadingListItems.SYNC_CHANGE_FLAGS);
object.remove(ReadingListItems.CLIENT_LAST_MODIFIED);
return new ClientReadingListRecord(sm, cm, object);
}
示例5: removeObsoleteId
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
/**
* Remove id from set of obsolete document ids tracked for deletion.
*
* Public for testing.
*
* @param id to stop tracking.
*/
public void removeObsoleteId(String id) {
ExtendedJSONObject ids = getObsoleteIds();
ids.remove(id);
setObsoleteIds(ids);
}