@RequestMapping(value = "/{id}", method = RequestMethod.GET) public ResponseEntity<Pet> get(@PathVariable Long id) { Pet p = service.get(id); return new ResponseEntity<Pet>(p, HttpStatus.OK); }
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public ResponseEntity<Pet> delete(@PathVariable("id") final Long id) { Pet p = service.delete(id); return new ResponseEntity<Pet>(p, HttpStatus.OK); }
@RequestMapping(method = RequestMethod.GET) public ResponseEntity<List<Pet>> getAll() { return new ResponseEntity<List<Pet>>(service.getAll(), HttpStatus.OK); }
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public ResponseEntity<Pet> put(@PathVariable("id") final Long id, @RequestBody Pet pet) { Pet p = service.put(id, pet); return new ResponseEntity<Pet>(p, HttpStatus.OK); }
@RequestMapping(method = RequestMethod.POST) public ResponseEntity<Pet> post(@RequestBody Pet pet) { Pet p = service.create(pet); return new ResponseEntity<Pet>(p, HttpStatus.CREATED); }