Last active
November 21, 2016 06:30
-
-
Save lefloh/b1031535ec1bcb4188e7710e1b07d400 to your computer and use it in GitHub Desktop.
CustomersResource#getCustomer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Customer getCustomer(@PathParam("id") long id, @Context UriInfo uriInfo) { | |
Optional<Customer> customer = findCustomer(id); | |
if (!customer.isPresent()) { | |
throw new NotFoundException( | |
String.format("No customer with id %d found. RequestUri was %s", | |
id, uriInfo.getRequestUri())); | |
} | |
return customer.get(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment