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/26 16:19:22 UTC

(causeway-app-petclinic) 01/10: adds iconname to Pet

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 359bf5c443dc7a2bd1107b4cde410e1163fe2dbf
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun May 26 14:42:08 2024 +0100

    adds iconname to Pet
    
    ... to dynamically specify the icon.
---
 .../src/main/java/domainapp/modules/petowner/dom/pet/Pet.java        | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/module-petowner/src/main/java/domainapp/modules/petowner/dom/pet/Pet.java b/module-petowner/src/main/java/domainapp/modules/petowner/dom/pet/Pet.java
index 5e3872c..de5ba48 100644
--- a/module-petowner/src/main/java/domainapp/modules/petowner/dom/pet/Pet.java
+++ b/module-petowner/src/main/java/domainapp/modules/petowner/dom/pet/Pet.java
@@ -20,6 +20,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 import org.apache.causeway.applib.annotation.DomainObject;
 import org.apache.causeway.applib.annotation.DomainObjectLayout;
+import org.apache.causeway.applib.annotation.ObjectSupport;
 import org.apache.causeway.applib.annotation.Property;
 import org.apache.causeway.applib.annotation.PropertyLayout;
 import org.apache.causeway.applib.annotation.Publishing;
@@ -73,6 +74,10 @@ public class Pet implements Comparable<Pet> {
         this.name = name;
     }
 
+    @ObjectSupport
+    public String iconName() {
+        return getSpecies().name().toLowerCase();
+    }
 
     @ManyToOne(optional = false)
     @JoinColumn(name = "owner_id")