@Override
public void writeTo(Collection<IndexerDefinition> indices, Class<?> type,
Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream outputStream)
throws IOException, WebApplicationException {
ArrayNode array = JsonNodeFactory.instance.arrayNode();
IndexerDefinitionJsonSerDeser converter = IndexerDefinitionJsonSerDeser.INSTANCE;
for (IndexerDefinition index : indices) {
array.add(converter.toJson(index));
}
ObjectMapper objectMapper = new ObjectMapper();
IOUtils.write(objectMapper.writeValueAsBytes(array), outputStream);
}