You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/03/15 14:48:15 UTC

[causeway] branch master updated: CAUSEWAY-3379: remove deprecated DomainObject#logicalTypeName

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 03dea45eec CAUSEWAY-3379: remove deprecated DomainObject#logicalTypeName
03dea45eec is described below

commit 03dea45eec6c89712f28ca8e1181a6dff59efc6e
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Mar 15 15:48:08 2023 +0100

    CAUSEWAY-3379: remove deprecated DomainObject#logicalTypeName
---
 .../pages/index/annotation/DomainObject.adoc       | 28 ----------------------
 .../causeway/applib/annotation/DomainObject.java   | 18 --------------
 .../org/apache/causeway/applib/id/LogicalType.java | 12 +---------
 .../DomainObjectAnnotationFacetFactory.java        |  4 +---
 .../applib/classrules/_LogicalNaming.java          | 20 +++++-----------
 5 files changed, 8 insertions(+), 74 deletions(-)

diff --git a/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc b/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc
index 5d0ae495e4..30bab6077f 100644
--- a/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc
+++ b/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc
@@ -21,8 +21,6 @@ If - for the currently logged on user - none of the domain object's members are
   Introspection introspection() default Introspection.NOT_SPECIFIED;     // <.>
   String mixinMethod() default "$$";     // <.>
   Nature nature() default Nature.NOT_SPECIFIED;     // <.>
-  @Deprecated(forRemoval = true, since = "2.0.0-M8")
-String logicalTypeName() default "";     // <.>
   Class<? extends ObjectCreatedEvent<?>> createdLifecycleEvent() default ObjectCreatedEvent.Default.class;     // <.>
   Class<? extends ObjectPersistingEvent<?>> persistingLifecycleEvent() default ObjectPersistingEvent.Default.class;     // <.>
   Class<? extends ObjectPersistedEvent<?>> persistedLifecycleEvent() default ObjectPersistedEvent.Default.class;     // <.>
@@ -86,18 +84,6 @@ Applicable only if _#nature()_ is _Nature#MIXIN_ , indicates the name of the met
 --
 The nature of this domain object.
 --
-<.> xref:#logicalTypeName[logicalTypeName]
-+
---
-[WARNING]
-====
-[red]#_deprecated:_#
-
-use _Named_ instead
-====
-
-The logical name of this object's type, that uniquely and fully qualifies it. The logical name is analogous to - but independent of - the actual fully qualified class name. eg. _sales.Customer_ for a class 'org.mycompany.dom.Customer'
---
 <.> xref:#createdLifecycleEvent[createdLifecycleEvent]
 +
 --
@@ -221,20 +207,6 @@ Most common are natures of _Nature#ENTITY_ and _Nature#VIEW_MODEL_ . For mixins,
 
 The _Nature#BEAN_ nature is for internally use, and should not normally be specified explicitly.
 
-[#logicalTypeName]
-=== logicalTypeName
-
-[WARNING]
-====
-[red]#_deprecated:_#
-
-use _Named_ instead
-====
-
-The logical name of this object's type, that uniquely and fully qualifies it. The logical name is analogous to - but independent of - the actual fully qualified class name. eg. _sales.Customer_ for a class 'org.mycompany.dom.Customer'
-
-This value, if specified, is used in the serialized form of the object's xref:refguide:applib:index/services/bookmark/Bookmark.adoc[Bookmark] . A xref:refguide:applib:index/services/bookmark/Bookmark.adoc[Bookmark] is used by the framework to uniquely identify an object over time (same concept as a URN). Otherwise, if not specified, the fully qualified class name is used instead.
-
 [#createdLifecycleEvent]
 === createdLifecycleEvent
 
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java b/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java
index 5f9100029f..567cfe5bcc 100644
--- a/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java
@@ -202,24 +202,6 @@ public @interface DomainObject {
     Nature nature()
             default Nature.NOT_SPECIFIED;
 
-    /**
-     * The logical name of this object's type, that uniquely and fully qualifies it.
-     * The logical name is analogous to - but independent of - the actual fully qualified class name.
-     * eg. {@code sales.Customer} for a class 'org.mycompany.dom.Customer'
-     * <p>
-     * This value, if specified, is used in the serialized form of the object's {@link Bookmark}.
-     * A {@link Bookmark} is used by the framework to uniquely identify an object over time
-     * (same concept as a URN).
-     * Otherwise, if not specified, the fully qualified class name is used instead.
-     * </p>
-     * @deprecated use {@link Named} instead
-     * @see Named
-     */
-    @Deprecated(forRemoval = true, since = "2.0.0-M8")
-    String logicalTypeName()
-            default "";
-
-
     /**
      * Indicates that the loading of the domain object should be posted to the
      * {@link org.apache.causeway.applib.services.eventbus.EventBusService event bus} using a custom (subclass of)
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/id/LogicalType.java b/api/applib/src/main/java/org/apache/causeway/applib/id/LogicalType.java
index bf8c4c2a74..43dfef4260 100644
--- a/api/applib/src/main/java/org/apache/causeway/applib/id/LogicalType.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/id/LogicalType.java
@@ -128,17 +128,7 @@ implements
             return eager(correspondingClass, named);
         }
 
-        // 3x deprecated naming strategies ...
-
-        {
-            val logicalTypeName = _Strings.emptyToNull(
-                    _Annotations.synthesize(correspondingClass, DomainObject.class)
-                    .map(DomainObject::logicalTypeName)
-                    .orElse(null));
-            if(logicalTypeName!=null) {
-                return eager(correspondingClass, logicalTypeName);
-            }
-        }
+        // deprecated naming strategies ...
 
         {
             val logicalTypeName = _Strings.emptyToNull(
diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
index 636086c25e..e63564c2dc 100644
--- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
@@ -45,7 +45,6 @@ import org.apache.causeway.applib.events.lifecycle.ObjectRemovingEvent;
 import org.apache.causeway.applib.events.lifecycle.ObjectUpdatedEvent;
 import org.apache.causeway.applib.events.lifecycle.ObjectUpdatingEvent;
 import org.apache.causeway.applib.id.LogicalType;
-import org.apache.causeway.commons.internal.base._Strings;
 import org.apache.causeway.commons.internal.collections._Multimaps;
 import org.apache.causeway.core.config.progmodel.ProgrammingModelConstants;
 import org.apache.causeway.core.metamodel.context.MetaModelContext;
@@ -161,8 +160,7 @@ implements
         }
 
         if(domainObject.nature().isMixin()
-                && (_Strings.isNotEmpty(domainObject.logicalTypeName())
-                        || processClassContext.synthesizeOnType(Named.class).isPresent())) {
+                && processClassContext.synthesizeOnType(Named.class).isPresent()) {
             // just a console warning, not decided yet whether we should be strict and fail MM validation
             log.warn("Mixins don't need a logicalTypeName, as was declared with {}.", cls.getName());
         }
diff --git a/testing/archtestsupport/applib/src/main/java/org/apache/causeway/testing/archtestsupport/applib/classrules/_LogicalNaming.java b/testing/archtestsupport/applib/src/main/java/org/apache/causeway/testing/archtestsupport/applib/classrules/_LogicalNaming.java
index 54b2296815..715032a09e 100644
--- a/testing/archtestsupport/applib/src/main/java/org/apache/causeway/testing/archtestsupport/applib/classrules/_LogicalNaming.java
+++ b/testing/archtestsupport/applib/src/main/java/org/apache/causeway/testing/archtestsupport/applib/classrules/_LogicalNaming.java
@@ -24,10 +24,8 @@ import javax.inject.Named;
 
 import com.tngtech.archunit.core.domain.JavaClass;
 
-import org.apache.causeway.applib.annotation.DomainObject;
 import org.apache.causeway.commons.internal.base._Strings;
 
-import lombok.val;
 import lombok.experimental.UtilityClass;
 
 @UtilityClass
@@ -40,18 +38,12 @@ class _LogicalNaming {
 
     public Optional<String> explicitLogicalNameFor(final JavaClass javaClass) {
 
-        val domainObjectIfAny = javaClass.tryGetAnnotationOfType(DomainObject.class);
-        String logicalTypeName = null;
-        if (domainObjectIfAny.isPresent()) {
-            logicalTypeName = _Strings.emptyToNull(domainObjectIfAny.get().logicalTypeName());
-        }
-        // override on presence
-        val namedIfAny = javaClass.tryGetAnnotationOfType(Named.class);
-        if (namedIfAny.isPresent()) {
-            logicalTypeName = namedIfAny.get().value();
-        }
-
-        return _Strings.nonEmpty(logicalTypeName);
+        final String nullableLogicalTypeName = javaClass
+                .tryGetAnnotationOfType(Named.class)
+                .map(Named::value)
+                .orElse(null);
+
+        return _Strings.nonEmpty(nullableLogicalTypeName);
 
     }