+ //
+ // 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 static JsonNode getSones(Set<Sone> sones) {
+ ArrayNode soneArray = new ArrayNode(instance);
+ for (Sone sone : FluentIterable.from(sones).toSortedList(NICE_NAME_COMPARATOR)) {
+ soneArray.add(new ObjectNode(instance).put("id", sone.getId()).put("name", SoneAccessor.getNiceName(sone)));
+ }
+ return soneArray;
+ }
+