Skip to content

Instantly share code, notes, and snippets.

@eldermoraes
Created December 13, 2018 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eldermoraes/72af8cfb5c64f5d4c345427617b019cd to your computer and use it in GitHub Desktop.
Save eldermoraes/72af8cfb5c64f5d4c345427617b019cd to your computer and use it in GitHub Desktop.
private JsonObject asJsonObject(Book book, URI bookUri,
URI authorUri) {
return Json.createObjectBuilder()
.add("isbn", book.isbn)
.add("title", book.title)
.add("_links", Json.createObjectBuilder()
.add("self", Json.createObjectBuilder()
.add("href", bookUri.toString()))
.add("author", Json.createObjectBuilder()
.add("href",
authorUri.toString())))
.build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment