- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Gson g =
new Gson()
GsonBuilder gsonBuilder;gsonBuilder.create()
new GsonBuilder().create()
- Smart code suggestions by Codota
}
public Object get(String id) { return client.find(id); }
@Override protected Optional<T> executeCommand(CouchDbClient couchDbClient) { try { T result = couchDbClient.find(clazz, id); return Optional.of(result); } catch (NoDocumentException e) { return Optional.empty(); } } }
@Override protected Boolean executeCommand(CouchDbClient couchDbClient) { try { T result = couchDbClient.find(clazz, key); couchDbClient.remove(result); return true; } catch (NoDocumentException e) { return false; } } }
@DELETE @Path("/file/{fileName}") @Override public Response deleteFile(@PathParam("fileName") String fileName) { CouchDbClient couchDbClient = getCouchDbClient(); JsonObject found = couchDbClient.find(JsonObject.class, fileName); couchDbClient.remove(found.get("_id").getAsString(), found.get("_rev").getAsString()); File file = new File(mainFilePath + fileName); file.delete(); LOG.info("Deleted: " + fileName); return Response.ok().build(); }
@DELETE @Path("/file/{fileName}") @Override public Response deleteFile(@PathParam("fileName") String fileName) { CouchDbClient couchDbClient = getCouchDbClient(); JsonObject found = couchDbClient.find(JsonObject.class, fileName); couchDbClient.remove(found.get("_id").getAsString(), found.get("_rev").getAsString()); File file = new File(mainFilePath + fileName); file.delete(); LOG.info("Deleted: " + fileName); return Response.ok().build(); }