Skip to content

Instantly share code, notes, and snippets.

@rlubke
Last active October 19, 2021 03:06
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 rlubke/d61f4356830dff423af3962b96518788 to your computer and use it in GitHub Desktop.
Save rlubke/d61f4356830dff423af3962b96518788 to your computer and use it in GitHub Desktop.
REST -> GET / | GET /?completed=[bool]
@Get
@Produces(MediaType.APPLICATION_JSON)
public Collection<Task> getTasks(@Nullable @QueryValue(value = "completed") Boolean completed)
{
Filter<Task> filter = completed == null
? Filters.always()
: Filters.equal(Task::getCompleted, completed);
return tasks.getAllOrderedBy(filter, Task::getCreatedAt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment