You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/04/27 09:05:22 UTC

[isis] branch master updated: ISIS-3020: switch on multivariate parameter support by default

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


The following commit(s) were added to refs/heads/master by this push:
     new b8fdc5df35 ISIS-3020: switch on multivariate parameter support by default
b8fdc5df35 is described below

commit b8fdc5df35a5a8228f6b724bca7b60948de5c019
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Apr 27 11:05:15 2022 +0200

    ISIS-3020: switch on multivariate parameter support by default
    
    - always enabled, unless explicitly disabled via environment variable
    MULTIVARIATE_PARAMETER_SUPPORT=false
---
 .../annotation/MultivariateParameterSupport.adoc   | 33 -------------
 .../annotation/MultivariateParameterSupport.java   | 57 ----------------------
 .../progmodel/ProgrammingModelConstants.java       |  2 +
 ...ActionParameterSupportFacetFactoryAbstract.java | 14 +++++-
 ...onParameterValidationFacetViaMethodFactory.java |  7 +--
 .../isis/core/metamodel/specloader/_Util.java      |  2 +-
 6 files changed, 17 insertions(+), 98 deletions(-)

diff --git a/antora/components/refguide-index/modules/applib/pages/index/annotation/MultivariateParameterSupport.adoc b/antora/components/refguide-index/modules/applib/pages/index/annotation/MultivariateParameterSupport.adoc
deleted file mode 100644
index b0a0f1de79..0000000000
--- a/antora/components/refguide-index/modules/applib/pages/index/annotation/MultivariateParameterSupport.adoc
+++ /dev/null
@@ -1,33 +0,0 @@
-= @MultivariateParameterSupport
-: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 [...]
-
-[WARNING]
-====
-[red]#_deprecated:_#
-
-likely to be phased out with later releases, while there is yet no definitive schedule
-====
-
-Indicates that a method is supporting an _Action_ parameter, while allowing for one or more than one arguments to be passed in.
-
-Following method templates are supported to receive a xref:refguide:applib:index/annotation/MultivariateParameterSupport.adoc[MultivariateParameterSupport] annotation:
-
-* hideNXxx
-* disableNXxx
-* choicesNXxx
-* autoCompleteNXxx
-* validateNXxx
-
-By placing the xref:refguide:applib:index/annotation/MultivariateParameterSupport.adoc[MultivariateParameterSupport] annotation on a method, a contract with the meta-model is enforced, such that this method must be recognized by the meta-model and cannot be ignored.
-
-It was introduced to allow compatibility with the _Apache Isis v1_ programming model and is likely going to be phased out with later releases.
-
-== API
-
-[source,java]
-.MultivariateParameterSupport.java
-----
-@interface MultivariateParameterSupport {
-}
-----
-
diff --git a/api/applib/src/main/java/org/apache/isis/applib/annotation/MultivariateParameterSupport.java b/api/applib/src/main/java/org/apache/isis/applib/annotation/MultivariateParameterSupport.java
deleted file mode 100644
index 3cf178176b..0000000000
--- a/api/applib/src/main/java/org/apache/isis/applib/annotation/MultivariateParameterSupport.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  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 agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.isis.applib.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates that a method is supporting an <i>Action</i> parameter,
- * while allowing for one or more than one arguments to be passed in.
- * <p>
- * Following method templates are supported to receive a {@link MultivariateParameterSupport} annotation:
- * <ul><li>hideNXxx</li><li>disableNXxx</li><li>choicesNXxx</li><li>autoCompleteNXxx</li><li>validateNXxx</li></ul>
- * <p>
- * By placing the {@link MultivariateParameterSupport} annotation on a method,
- * a contract with the meta-model is enforced,
- * such that this method must be recognized by the meta-model and cannot be ignored.
- * <p>
- * It was introduced to allow compatibility with the <i>Apache Isis v1</i> programming model
- * and is likely going to be phased out with later releases.
- *
- * @since 2.0 {@index}
- * @see MemberSupport
- * @see ObjectSupport
- * @see ObjectLifecycle
- * @see Programmatic
- * @deprecated likely to be phased out with later releases, while there is yet no definitive schedule
- */
-@Deprecated(since = "2.0.0-RC1")
-@Inherited
-@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Domain.Include // meta annotation, in support of meta-model validation
-public @interface MultivariateParameterSupport {
-
-}
-
-
diff --git a/core/config/src/main/java/org/apache/isis/core/config/progmodel/ProgrammingModelConstants.java b/core/config/src/main/java/org/apache/isis/core/config/progmodel/ProgrammingModelConstants.java
index c1f2b6fd9b..8dc2ca1b07 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/progmodel/ProgrammingModelConstants.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/progmodel/ProgrammingModelConstants.java
@@ -85,6 +85,8 @@ public final class ProgrammingModelConstants {
         }
     }
 
+    // -- METHOD VETO MARKERS (EXLUDE FROM DOMAIN)
+
     @Getter
     @RequiredArgsConstructor
     public enum MethodVetoMarker {
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/support/ActionParameterSupportFacetFactoryAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/support/ActionParameterSupportFacetFactoryAbstract.java
index dc6596ac36..339c861e25 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/support/ActionParameterSupportFacetFactoryAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/support/ActionParameterSupportFacetFactoryAbstract.java
@@ -73,7 +73,11 @@ extends MemberAndPropertySupportFacetFactoryAbstract {
                         ParameterSupport.ParamSupportingMethodSearchRequest.builder()
                         .processMethodContext(processMethodContext)
                         .paramIndexToMethodNameProviders(methodNameCandidates)
-                        .searchAlgorithms(EnumSet.of(SearchAlgorithm.PAT, SearchAlgorithm.SWEEP))
+                        .searchAlgorithms(EnumSet.of(
+                                SearchAlgorithm.PAT,
+                                isMultivariateParameterSupportEnabled()
+                                    ? SearchAlgorithm.SWEEP
+                                    : SearchAlgorithm.SINGLEARG_BEING_PARAMTYPE))
                         .returnTypePattern(memberSupportPrefix.getSupportMethodReturnType()))
                 .build();
 
@@ -91,4 +95,12 @@ extends MemberAndPropertySupportFacetFactoryAbstract {
             FacetedMethodParameter paramAsHolder,
             ParamSupportingMethodSearchResult searchResult);
 
+    // -- HELPER
+
+    /** Always enabled, unless explicitly disabled via environment variable
+     * {@code MULTIVARIATE_PARAMETER_SUPPORT=true}. */
+    private boolean isMultivariateParameterSupportEnabled() {
+        return !"false".equalsIgnoreCase(System.getenv("MULTIVARIATE_PARAMETER_SUPPORT"));
+    }
+
 }
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/validate/method/ActionParameterValidationFacetViaMethodFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/validate/method/ActionParameterValidationFacetViaMethodFactory.java
index e720d45fdb..e7c3cf0e3a 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/validate/method/ActionParameterValidationFacetViaMethodFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/param/validate/method/ActionParameterValidationFacetViaMethodFactory.java
@@ -18,15 +18,12 @@
  */
 package org.apache.isis.core.metamodel.facets.param.validate.method;
 
-import java.util.EnumSet;
-
 import javax.inject.Inject;
 
 import org.apache.isis.core.config.progmodel.ProgrammingModelConstants.MemberSupportPrefix;
 import org.apache.isis.core.metamodel.context.MetaModelContext;
 import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
 import org.apache.isis.core.metamodel.facets.ParameterSupport.ParamSupportingMethodSearchResult;
-import org.apache.isis.core.metamodel.facets.ParameterSupport.SearchAlgorithm;
 import org.apache.isis.core.metamodel.facets.param.support.ActionParameterSupportFacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.param.validate.ActionParameterValidationFacet;
 
@@ -39,9 +36,7 @@ extends ActionParameterSupportFacetFactoryAbstract  {
 
     @Inject
     public ActionParameterValidationFacetViaMethodFactory(final MetaModelContext mmc) {
-        super(mmc, MemberSupportPrefix.VALIDATE, searchOptions->
-            searchOptions
-            .searchAlgorithms(EnumSet.of(SearchAlgorithm.PAT, SearchAlgorithm.SINGLEARG_BEING_PARAMTYPE)));
+        super(mmc, MemberSupportPrefix.VALIDATE);
     }
 
     @Override
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/_Util.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/_Util.java
index 1dcc5b537c..93caf9dc6e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/_Util.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/_Util.java
@@ -89,7 +89,7 @@ final class _Util {
             .map(IsisBeanTypeClassifier::getClass)
             .map(Class::getSimpleName)
             .anyMatch(classifierName->classifierName.startsWith("Jdo"))
-            ? "JDO "
+            ? "JDO"
             : "JPA";
     }