You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/11/23 08:36:08 UTC

[isis] 02/04: ISIS-2043: adds ActionDomainEvent#getSubject() as a convenience

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit cab9e464aa0b9661ada58ab3a0f9b2512afc63d0
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Nov 21 22:42:12 2018 +0100

    ISIS-2043: adds ActionDomainEvent#getSubject() as a convenience
---
 .../isis/applib/services/eventbus/ActionDomainEvent.java | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
index 1ff72cf..1d97fc2 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
@@ -210,6 +210,22 @@ public abstract class ActionDomainEvent<S> extends AbstractInteractionEvent<S> {
     }
     // endregion
 
+
+
+    // region > subject
+
+    /**
+     * The subject of the event, which will be either the {@link #getSource() source} for a regular action, or the
+     * {@link #getMixedIn() mixed-in} domain object for a mixin.
+     */
+    public Object getSubject() {
+        final Object mixedIn = getMixedIn();
+        return mixedIn != null ? mixedIn : getSource();
+    }
+
+
+    //endregion
+
     //region > arguments
     private List<Object> arguments;
     /**