コード例 #1
0
 private String toXContent(ToXContent x) {
   try {
     XContentBuilder builder = XContentFactory.jsonBuilder();
     builder.startObject();
     x.toXContent(builder, ToXContent.EMPTY_PARAMS);
     builder.endObject();
     return builder.string();
   } catch (IOException e) {
     return "{ \"error\" : \"" + e.getMessage() + "\"}";
   }
 }