+ //
+ // PRIVATE METHODS
+ //
+
+ /**
+ * Creates a JSON array (containing the IDs and the nice names) from the
+ * given Sones, after sorting them by name.
+ *
+ * @param sones
+ * The Sones to convert to an array
+ * @return The Sones, sorted by name
+ */
+ private JsonArray getSones(Set<Sone> sones) {
+ JsonArray soneArray = new JsonArray();
+ List<Sone> sortedSones = new ArrayList<Sone>(sones);
+ Collections.sort(sortedSones, Sone.NICE_NAME_COMPARATOR);
+ for (Sone sone : sortedSones) {
+ soneArray.add(new JsonObject().put("id", sone.getId()).put("name", SoneAccessor.getNiceName(sone)));
+ }
+ return soneArray;
+ }
+