/** * Convert a {@link JsonObject} to a {@link ChunkMeta} object * @param source the JSON object to convert * @return the converted object */ private ChunkMeta getMeta(JsonObject source) { String mimeType = source.getString("mimeType", XMLChunkMeta.MIME_TYPE); if (belongsTo(mimeType, "application", "xml") || belongsTo(mimeType, "text", "xml")) { return new XMLChunkMeta(source); } else if (belongsTo(mimeType, "application", "geo+json")) { return new GeoJsonChunkMeta(source); } else if (belongsTo(mimeType, "application", "json")) { return new JsonChunkMeta(source); } else { return new ChunkMeta(source); } }
/** * Create a {@link XMLChunkMeta} object. Sub-classes may override this * method to provide their own {@link XMLChunkMeta} type. * @param hit the chunk meta content used to initialize the object * @return the created object */ protected ChunkMeta createChunkMeta(JsonObject hit) { String mimeType = hit.getString("mimeType", XMLChunkMeta.MIME_TYPE); if (belongsTo(mimeType, "application", "xml") || belongsTo(mimeType, "text", "xml")) { return new XMLChunkMeta(hit); } else if (belongsTo(mimeType, "application", "geo+json")) { return new GeoJsonChunkMeta(hit); } else if (belongsTo(mimeType, "application", "json")) { return new JsonChunkMeta(hit); } return new ChunkMeta(hit); } }