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 2020/01/19 18:20:43 UTC

[isis] branch master updated (42d30b9 -> 2ccaf33)

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

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


    from 42d30b9  ISIS-2223: use serializable map explicitly
     new d0d9d64  ISIS-2223: remove ThreadLocal FORMATS from ValueSemanticsProviderAbstractTemporal
     new 2ccaf33  ISIS-2223: dont check whether Optional is null

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../core/metamodel/facets/MethodFinderUtils.java   | 10 ++++-----
 .../ValueSemanticsProviderAbstractTemporal.java    | 25 ----------------------
 2 files changed, 4 insertions(+), 31 deletions(-)


[isis] 02/02: ISIS-2223: dont check whether Optional is null

Posted by ah...@apache.org.
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

commit 2ccaf33242dc05d1a474cef68f7c6a40c929af52
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Jan 19 19:20:30 2020 +0100

    ISIS-2223: dont check whether Optional is null
---
 .../apache/isis/core/metamodel/facets/MethodFinderUtils.java   | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
index 1619687..147dfeb 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
@@ -171,12 +171,10 @@ public final class MethodFinderUtils {
             final Class<? extends Annotation> annotationClass,
             final Map<Class<?>, Optional<Method>> methods) {
 
-        final Class<?> clz = pojo.getClass();
-        Optional<Method> nullableMethod = methods.get(clz);
-        if(nullableMethod == null) {
-            nullableMethod = search(clz, annotationClass, methods);
-        }
-        return nullableMethod.orElse(null);
+        val clz = pojo.getClass();
+        val annotatedMethodIfAny = 
+                methods.computeIfAbsent(clz, __->search(clz, annotationClass, methods));
+        return annotatedMethodIfAny.orElse(null);
     }
 
     private static Optional<Method> search(


[isis] 01/02: ISIS-2223: remove ThreadLocal FORMATS from ValueSemanticsProviderAbstractTemporal

Posted by ah...@apache.org.
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

commit d0d9d6454819f4e24e8eb86a9e31e3b57a0cffb8
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Jan 19 19:16:38 2020 +0100

    ISIS-2223: remove ThreadLocal FORMATS from
    ValueSemanticsProviderAbstractTemporal
---
 .../ValueSemanticsProviderAbstractTemporal.java    | 25 ----------------------
 1 file changed, 25 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/ValueSemanticsProviderAbstractTemporal.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
index 0c96ee8..01db2d2 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
@@ -32,7 +32,6 @@ import java.util.TimeZone;
 
 import org.apache.isis.applib.adapters.EncodingException;
 import org.apache.isis.core.commons.internal.base._Casts;
-import org.apache.isis.core.commons.internal.collections._Maps;
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
@@ -44,26 +43,9 @@ public abstract class ValueSemanticsProviderAbstractTemporal<T>
 extends ValueSemanticsProviderAndFacetAbstract<T> 
 implements DateValueFacet {
 
-    /**
-     * Introduced to allow BDD tests to provide a different format string
-     * "mid-flight".
-     */
-    public static void setFormat(final String propertyType, final String formatStr) {
-        FORMATS.get().put(propertyType, formatStr);
-    }
-
-    private final static ThreadLocal<Map<String, String>> FORMATS = new ThreadLocal<Map<String, String>>() {
-        @Override
-        protected java.util.Map<String, String> initialValue() {
-            return _Maps.newHashMap();
-        }
-    };
-
     protected static final String ISO_ENCODING_FORMAT = "iso_encoding";
     protected static final TimeZone UTC_TIME_ZONE;
 
-    //public final static String FORMAT_KEY_PREFIX = ConfigurationConstants.ROOT + "value.format.";
-
     static {
         TimeZone timeZone = TimeZone.getTimeZone("Etc/UTC");
         if (timeZone == null) {
@@ -121,14 +103,7 @@ implements DateValueFacet {
     }
 
     protected void buildDefaultFormatIfRequired() {
-        final Map<String, String> map = FORMATS.get();
-        final String currentlyConfiguredFormat = map.get(propertyType);
-        if (currentlyConfiguredFormat == null || getConfiguredFormat().equals(currentlyConfiguredFormat)) {
-            return;
-        }
-
         // (re)create format
-        setConfiguredFormat(currentlyConfiguredFormat);
         buildFormat(getConfiguredFormat());
     }