コード例 #1
0
 private void loadDeviceAliases(Json.JsonArray device_aliases) {
   for (int i = 0; i < device_aliases.size(); i++) {
     Json.JsonObject device = device_aliases.asObject(i);
     using(Model.class)
         .execute(
             DeviceAliasAdd.class,
             new P<String, DeviceAlias>(
                 device.asString("mac"),
                 new DeviceAlias(device.asString("alias"), device.value("icon", Integer.class))));
   }
 }
コード例 #2
0
 private void restoreProfiles(Json.JsonArray profilesJson) {
   for (int i = 0; i < profilesJson.size(); i++) {
     Json.JsonObject profile = profilesJson.asObject(i);
     using(BandwidthProfileManager.class)
         .updateOrCreate(
             new BandwidthProfile(
                 profile.asString("title"),
                 profile.asString("description"),
                 profile.value("out", Integer.class),
                 profile.value("in", Integer.class)));
   }
 }