本文整理汇总了Java中org.mozilla.gecko.sync.ExtendedJSONObject.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java ExtendedJSONObject.getBoolean方法的具体用法?Java ExtendedJSONObject.getBoolean怎么用?Java ExtendedJSONObject.getBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mozilla.gecko.sync.ExtendedJSONObject
的用法示例。
在下文中一共展示了ExtendedJSONObject.getBoolean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unpickleV3
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
private void unpickleV3(final ExtendedJSONObject json)
throws NonObjectJSONException, NoSuchAlgorithmException, InvalidKeySpecException {
// We'll overwrite the extracted sync automatically map.
unpickleV1(json);
// Extract the map of authorities to sync automatically.
authoritiesToSyncAutomaticallyMap.clear();
final ExtendedJSONObject o = json.getObject(KEY_AUTHORITIES_TO_SYNC_AUTOMATICALLY_MAP);
if (o == null) {
return;
}
for (String key : o.keySet()) {
final Boolean enabled = o.getBoolean(key);
if (enabled != null) {
authoritiesToSyncAutomaticallyMap.put(key, enabled);
}
}
}
示例2: fromJSONObjectV3
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
/**
* Exactly the same as {@link fromJSONObjectV2}, except that there's a new
* MigratedFromSyncV11 state.
*/
protected static State fromJSONObjectV3(StateLabel stateLabel, ExtendedJSONObject o) throws InvalidKeySpecException, NoSuchAlgorithmException, NonObjectJSONException {
switch (stateLabel) {
case MigratedFromSync11:
return new MigratedFromSync11(
o.getString("email"),
o.getString("uid"),
o.getBoolean("verified"),
o.getString("password"));
default:
return fromJSONObjectV2(stateLabel, o);
}
}
示例3: getBundleDataBoolean
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
protected boolean getBundleDataBoolean(String key, boolean def) {
ExtendedJSONObject o = unbundle();
if (o == null) {
return def;
}
Boolean b = o.getBoolean(key);
if (b == null) {
return def;
}
return b;
}
示例4: fromJSONObjectV1
import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
protected static State fromJSONObjectV1(StateLabel stateLabel, ExtendedJSONObject o) throws InvalidKeySpecException, NoSuchAlgorithmException, NonObjectJSONException {
switch (stateLabel) {
case Engaged:
return new Engaged(
o.getString("email"),
o.getString("uid"),
o.getBoolean("verified"),
Utils.hex2Byte(o.getString("unwrapkB")),
Utils.hex2Byte(o.getString("sessionToken")),
Utils.hex2Byte(o.getString("keyFetchToken")));
case Cohabiting:
return new Cohabiting(
o.getString("email"),
o.getString("uid"),
Utils.hex2Byte(o.getString("sessionToken")),
Utils.hex2Byte(o.getString("kA")),
Utils.hex2Byte(o.getString("kB")),
keyPairFromJSONObjectV1(o.getObject("keyPair")));
case Married:
return new Married(
o.getString("email"),
o.getString("uid"),
Utils.hex2Byte(o.getString("sessionToken")),
Utils.hex2Byte(o.getString("kA")),
Utils.hex2Byte(o.getString("kB")),
keyPairFromJSONObjectV1(o.getObject("keyPair")),
o.getString("certificate"));
case Separated:
return new Separated(
o.getString("email"),
o.getString("uid"),
o.getBoolean("verified"));
case Doghouse:
return new Doghouse(
o.getString("email"),
o.getString("uid"),
o.getBoolean("verified"));
default:
throw new IllegalStateException("unrecognized state label: " + stateLabel);
}
}
示例5: 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);
}