本文整理匯總了Java中org.mozilla.gecko.sync.ExtendedJSONObject.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ExtendedJSONObject.get方法的具體用法?Java ExtendedJSONObject.get怎麽用?Java ExtendedJSONObject.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mozilla.gecko.sync.ExtendedJSONObject
的用法示例。
在下文中一共展示了ExtendedJSONObject.get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initFromEnvelope
import org.mozilla.gecko.sync.ExtendedJSONObject; //導入方法依賴的package包/類
public void initFromEnvelope(CryptoRecord envelope) {
ExtendedJSONObject p = envelope.payload;
this.guid = envelope.guid;
checkGUIDs(p);
this.collection = envelope.collection;
this.lastModified = envelope.lastModified;
final Object del = p.get("deleted");
if (del instanceof Boolean) {
this.deleted = (Boolean) del;
} else {
this.initFromPayload(p);
}
}
示例2: limitObsoleteIds
import org.mozilla.gecko.sync.ExtendedJSONObject; //導入方法依賴的package包/類
/**
* We want cleaning up documents on the server to be best effort. Purge badly
* formed IDs and cap the number of times we try to delete so that the queue
* doesn't take too long.
*/
public void limitObsoleteIds() {
ExtendedJSONObject ids = getObsoleteIds();
Set<String> keys = new HashSet<String>(ids.keySet()); // Avoid invalidating an iterator.
for (String key : keys) {
Object o = ids.get(key);
if (!(o instanceof Long)) {
continue;
}
if ((Long) o > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
ids.put(key, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID);
}
}
setObsoleteIds(ids);
}
示例3: tabFromJSONObject
import org.mozilla.gecko.sync.ExtendedJSONObject; //導入方法依賴的package包/類
public static Tab tabFromJSONObject(JSONObject o) throws NonArrayJSONException {
ExtendedJSONObject obj = new ExtendedJSONObject(o);
String title = obj.getString("title");
String icon = obj.getString("icon");
JSONArray history = obj.getArray("urlHistory");
// Last used is inexplicably a string in seconds. Most of the time.
long lastUsed = 0;
Object lU = obj.get("lastUsed");
if (lU instanceof Number) {
lastUsed = ((Long) lU) * 1000L;
} else if (lU instanceof String) {
try {
lastUsed = Long.parseLong((String) lU, 10) * 1000L;
} catch (NumberFormatException e) {
Logger.debug(TabsRecord.LOG_TAG, "Invalid number format in lastUsed: " + lU);
}
}
return new Tab(title, icon, history, lastUsed);
}
示例4: initFromPayload
import org.mozilla.gecko.sync.ExtendedJSONObject; //導入方法依賴的package包/類
@Override
protected void initFromPayload(ExtendedJSONObject payload) {
this.histURI = (String) payload.get("histUri");
this.title = (String) payload.get("title");
try {
this.visits = payload.getArray("visits");
} catch (NonArrayJSONException e) {
Logger.error(LOG_TAG, "Got non-array visits in history record " + this.guid, e);
this.visits = new JSONArray();
}
}
示例5: decryptPayload
import org.mozilla.gecko.sync.ExtendedJSONObject; //導入方法依賴的package包/類
/**
* Helper method for doing actual decryption.
*
* Input: JSONObject containing a valid payload (cipherText, IV, HMAC),
* KeyBundle with keys for decryption. Output: byte[] clearText
*
* @throws CryptoException
* @throws UnsupportedEncodingException
*/
private byte[] decryptPayload(ExtendedJSONObject payload, KeyBundle keybundle)
throws CryptoException, UnsupportedEncodingException {
String sCiphertext = (String) payload.get(Constants.JSON_KEY_CIPHERTEXT);
String sIv = (String) payload.get(Constants.JSON_KEY_IV);
String sHmac = (String) payload.get(Constants.JSON_KEY_HMAC);
byte[] ciphertext = Utils.decodeBase64(sCiphertext);
byte[] iv = Utils.decodeBase64(sIv);
byte[] hmac = Utils.hex2Byte(sHmac);
CryptoInfo decrypted = CryptoInfo.decrypt(ciphertext, iv, hmac, keybundle);
return decrypted.getMessage();
}
示例6: initFromPayload
import org.mozilla.gecko.sync.ExtendedJSONObject; //導入方法依賴的package包/類
@Override
public void initFromPayload(ExtendedJSONObject payload) {
clientName = (String) payload.get("clientName");
try {
tabs = tabsFrom(payload.getArray("tabs"));
} catch (NonArrayJSONException e) {
// Oh well.
tabs = new ArrayList<Tab>();
}
}