Fix formatting

This commit is contained in:
Dave Syer 2024-01-31 21:52:37 +00:00
parent 2fe96130c0
commit 836d111e99
3 changed files with 8 additions and 5 deletions

View file

@ -99,7 +99,8 @@ class PetController {
}
@PostMapping("/pets/new")
public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult result, ModelMap model, RedirectAttributes redirectAttributes) {
public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult result, ModelMap model,
RedirectAttributes redirectAttributes) {
if (StringUtils.hasText(pet.getName()) && pet.isNew() && owner.getPet(pet.getName(), true) != null) {
result.rejectValue("name", "duplicate", "already exists");
}
@ -121,14 +122,16 @@ class PetController {
}
@GetMapping("/pets/{petId}/edit")
public String initUpdateForm(Owner owner, @PathVariable("petId") int petId, ModelMap model,RedirectAttributes redirectAttributes) {
public String initUpdateForm(Owner owner, @PathVariable("petId") int petId, ModelMap model,
RedirectAttributes redirectAttributes) {
Pet pet = owner.getPet(petId);
model.put("pet", pet);
return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
}
@PostMapping("/pets/{petId}/edit")
public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model,RedirectAttributes redirectAttributes) {
public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model,
RedirectAttributes redirectAttributes) {
String petName = pet.getName();