From cf91405ecb501f7422d72c425f0ad768d677d33b Mon Sep 17 00:00:00 2001 From: YiXuan Ding <1328032567@qq.com> Date: Tue, 5 Nov 2024 17:13:34 +0800 Subject: [PATCH] : rewrite method `getName()` comments. --- .../org/springframework/samples/petclinic/owner/Owner.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java index c5667b04465..612d89d2dc6 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java @@ -101,7 +101,7 @@ public void addPet(Pet pet) { /** * Return the Pet with the given name, or null if none found for this Owner. * @param name to test - * @return a pet if pet name is already in use + * @return the Pet with the given name, or null if no such Pet exists for this Owner */ public Pet getPet(String name) { return getPet(name, false); @@ -110,7 +110,7 @@ public Pet getPet(String name) { /** * Return the Pet with the given id, or null if none found for this Owner. * @param id to test - * @return a pet if pet id is already in use + * @return the Pet with the given id, or null if no such Pet exists for this Owner */ public Pet getPet(Integer id) { for (Pet pet : getPets()) { @@ -127,7 +127,8 @@ public Pet getPet(Integer id) { /** * Return the Pet with the given name, or null if none found for this Owner. * @param name to test - * @return a pet if pet name is already in use + * @param ignoreNew whether to ignore new pets (pets that are not saved yet) + * @return the Pet with the given name, or null if no such Pet exists for this Owner */ public Pet getPet(String name, boolean ignoreNew) { for (Pet pet : getPets()) {