/** A facet of the specified name. */ public Facet facet(String name) { for (Facet facet : facets) { if (facet.name().equals(name)) { return facet; } } return null; }
@Override public void toJson(JsonBuilder builder, Params params) throws IOException { builder.startObject("facets"); for (Facet facet : facets) { facet.toJson(builder, params); } builder.endObject(); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(facets.size()); for (Facet facet : facets) { out.writeByte(facet.type().id()); facet.writeTo(out); } }