1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/sync/EngineSettings.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,31 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.sync; 1.9 + 1.10 +public class EngineSettings { 1.11 + public final String syncID; 1.12 + public final int version; 1.13 + 1.14 + public EngineSettings(final String syncID, final int version) { 1.15 + this.syncID = syncID; 1.16 + this.version = version; 1.17 + } 1.18 + 1.19 + public EngineSettings(ExtendedJSONObject object) { 1.20 + try { 1.21 + this.syncID = object.getString("syncID"); 1.22 + this.version = object.getIntegerSafely("version").intValue(); 1.23 + } catch (Exception e ) { 1.24 + throw new IllegalArgumentException(e); 1.25 + } 1.26 + } 1.27 + 1.28 + public ExtendedJSONObject toJSONObject() { 1.29 + ExtendedJSONObject json = new ExtendedJSONObject(); 1.30 + json.put("syncID", syncID); 1.31 + json.put("version", version); 1.32 + return json; 1.33 + } 1.34 +}