当前位置: 首页>>代码示例>>Java>>正文


Java ExtendedJSONObject.remove方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:17,代码来源:ObsoleteDocumentTracker.java

示例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);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:8,代码来源:ObsoleteDocumentTracker.java

示例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);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:19,代码来源:ObsoleteDocumentTracker.java

示例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);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:57,代码来源:ReadingListClientRecordFactory.java

示例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);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:13,代码来源:ObsoleteDocumentTracker.java


注:本文中的org.mozilla.gecko.sync.ExtendedJSONObject.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。