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 2023/03/30 07:40:33 UTC

[causeway] 01/01: CAUSEWAY-2485: completes @DomainObject#mixinMethod

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/causeway.git

commit f452420d2f354b1858298db13fba97d8a7a2716a
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Mar 30 08:40:16 2023 +0100

    CAUSEWAY-2485: completes @DomainObject#mixinMethod
---
 .../DomainObjectIntrospectionVm-description.adoc    |  2 +-
 .../DomainObjectMixinMethodVm-description.adoc      |  4 +---
 .../DomainObjectMixinMethod_initialCharacter.java   |  4 ----
 .../DomainObjectMixinMethod_updateName.java         |  7 ++-----
 .../jpa/DomainObjectMixinMethodJpa-description.adoc | 21 ++++++++++++++-------
 5 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionVm-description.adoc
index e4a83b9cdf..4f28e16a26 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionVm-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionVm-description.adoc
@@ -44,4 +44,4 @@ However, it the need arises then it can be overridden on a class by class basis
 
 The collections on the left show three variants of the same entity, each with a property and an action, but each configured to use a different introspection policy.
 
-Navigate through to each class to inspect the differences in their source code.
+Navigate through to the entity to inspect the differences in their source code.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodVm-description.adoc
index 192af40c70..6c6b694ea5 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodVm-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodVm-description.adoc
@@ -37,6 +37,4 @@ include::DomainObjectMixinMethodVm_updateName.java[tags=class]
 <.> method representing the contributed domain collection, using the overridden method name
 
 The 'initialCharacter' column in the table is also a mixin, this time of the domain class in the collection.
-
-
-Navigate through to each class to inspect that mixin.
+Navigate through to the entity to inspect that mixin's source code.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_initialCharacter.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_initialCharacter.java
index 6149b39cdb..1ee07e2cd4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_initialCharacter.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_initialCharacter.java
@@ -1,12 +1,8 @@
 package demoapp.dom.domain.objects.DomainObject.mixinMethod;
 
-import demoapp.dom._infra.values.ValueHolderRepository;
 import lombok.RequiredArgsConstructor;
 import lombok.val;
 
-import javax.inject.Inject;
-
-import org.apache.causeway.applib.annotation.Action;
 import org.apache.causeway.applib.annotation.DomainObject;
 import org.apache.causeway.applib.annotation.MemberSupport;
 import org.apache.causeway.applib.annotation.Property;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_updateName.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_updateName.java
index f639bcfdc2..5c11e6e131 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_updateName.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethod_updateName.java
@@ -10,23 +10,20 @@ import javax.inject.Inject;
 import org.apache.causeway.applib.annotation.*;
 
 //tag::class[]
-@DomainObject(mixinMethod = "action")                           // <.>
+@DomainObject(mixinMethod = "action")                               // <.>
 @Action()
 @RequiredArgsConstructor
 public class DomainObjectMixinMethod_updateName {
 
-    @SuppressWarnings("unused")
     private final DomainObjectMixinMethod mixee;
 
     @MemberSupport
-    public DomainObjectMixinMethod action(                      // <.>
-                                      final String newName) {
+    public DomainObjectMixinMethod action(final String newName) {   // <.>
         mixee.setName(newName);
         return mixee;
     }
     public String default0Action() {
         return mixee.getName();
     }
-
 }
 //end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/jpa/DomainObjectMixinMethodJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/jpa/DomainObjectMixinMethodJpa-description.adoc
index 5df1d4b96b..b2d6d521d6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/jpa/DomainObjectMixinMethodJpa-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/jpa/DomainObjectMixinMethodJpa-description.adoc
@@ -1,17 +1,24 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...]
 
-TODO: In this demo app,
+This domain class has two mixins that both demonstrate the use of link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#mixinmethod[@DomainObject#mixinmethod] to override the default method names used by  link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/Property.html[@Property], link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/Collection.html[@Collection] or link:https://causeway. [...]
+
+The "initialCharacter" property mixin contributes a derived property:
 
 [source,java,indent=0]
-.DomainObjectMixinMethod_updateName.java
+.DomainObjectMixinMethod_initialCharacter.java
 ----
-include::../DomainObjectMixinMethod_updateName.java[tags=class]
+include::../DomainObjectMixinMethod_initialCharacter.java[tags=class]
 ----
-<.> xxx
+<.> overrides the default mixin method
+<.> method representing the contributed domain collection, using the overridden method name
+
+Meanwhile the "updateName" action mixin allows the name to be changed for the domain object:
 
 [source,java,indent=0]
-.DomainObjectMixinMethod_initialCharacter.java
+.DomainObjectMixinMethod_updateName.java
 ----
-include::../DomainObjectMixinMethod_initialCharacter.java[tags=class]
+include::../DomainObjectMixinMethod_updateName.java[tags=class]
 ----
-<.> xxx
+<.> overrides the default mixin method
+<.> method representing the contributed domain collection, using the overridden method name
+