MCPcopy Create free account
hub / github.com/M66B/FairEmail / fromJSON

Method fromJSON

app/src/main/java/eu/faircode/email/EntityFolder.java:757–832  ·  view source on GitHub ↗
(JSONObject json)

Source from the content-addressed store, hash-verified

755 }
756
757 public static EntityFolder fromJSON(JSONObject json) throws JSONException {
758 EntityFolder folder = new EntityFolder();
759 if (json.has("id"))
760 folder.id = json.getLong("id");
761
762 if (json.has("order"))
763 folder.order = json.getInt("order");
764
765 if (json.has("namespace"))
766 folder.namespace = json.getString("namespace");
767 if (json.has("separator"))
768 folder.separator = (char) json.getInt("separator");
769
770 folder.name = json.getString("name");
771 folder.type = json.getString("type");
772
773 folder.synchronize = json.getBoolean("synchronize");
774
775 if (json.has("poll"))
776 folder.poll = json.getBoolean("poll");
777 if (json.has("poll_factor"))
778 folder.poll_factor = json.getInt("poll_factor");
779
780 if (json.has("download"))
781 folder.download = json.getBoolean("download");
782
783 if (json.has("auto_classify_source"))
784 folder.auto_classify_source = json.getBoolean("auto_classify_source");
785 else
786 folder.auto_classify_source =
787 (EntityFolder.INBOX.equals(folder.type) ||
788 EntityFolder.JUNK.equals(folder.type));
789 if (json.has("auto_classify_target"))
790 folder.auto_classify_target = json.getBoolean("auto_classify_target");
791
792 if (json.has("after"))
793 folder.sync_days = json.getInt("after");
794 else
795 folder.sync_days = json.getInt("sync_days");
796
797 if (json.has("keep_days"))
798 folder.keep_days = json.getInt("keep_days");
799 else
800 folder.keep_days = folder.sync_days;
801
802 if (json.has("auto_delete"))
803 folder.auto_delete = json.getBoolean("auto_delete");
804
805 if (json.has("display") && !json.isNull("display"))
806 folder.display = json.getString("display");
807
808 if (json.has("color") && !json.isNull("color"))
809 folder.color = json.getInt("color");
810
811 if (json.has("hide"))
812 folder.hide = json.getBoolean("hide");
813
814 if (json.has("hide_seen"))

Callers 3

onRestoreMethod · 0.95
onExecuteMethod · 0.95
checkEmergencyBackupMethod · 0.95

Calls 6

getLongMethod · 0.80
getBooleanMethod · 0.80
isNullMethod · 0.80
getIntMethod · 0.45
getStringMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected