You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/05/25 12:48:26 UTC
(causeway-app-petclinic) 11/24: defines PetOwner's title using title() method rather than @Title annot.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch v2
in repository https://gitbox.apache.org/repos/asf/causeway-app-petclinic.git
commit 4a315b8215266095a7346240709b182c8678188f
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu May 23 06:12:55 2024 +0100
defines PetOwner's title using title() method rather than @Title annot.
---
.../java/domainapp/modules/petowner/dom/petowner/PetOwner.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
index d7c341c..833c426 100644
--- a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
+++ b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
@@ -23,6 +23,8 @@ import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.causeway.applib.annotation.ObjectSupport;
+
import org.springframework.lang.Nullable;
import org.apache.causeway.applib.annotation.Action;
@@ -116,8 +118,11 @@ public class PetOwner implements Comparable<PetOwner>, CalendarEventable {
@Inject @Transient MessageService messageService;
+ @ObjectSupport
+ public String title() {
+ return getName() + (getKnownAs() != null ? " (" + getKnownAs() + ")" : "");
+ }
- @Title
@Name
@Column(length = Name.MAX_LEN, nullable = false, name = "name")
@Getter @Setter @ToString.Include