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 2021/11/15 20:18:38 UTC

[isis] branch master updated: ISIS-2894: do not install MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified

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 572e3a8  ISIS-2894: do not install MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified
572e3a8 is described below

commit 572e3a8794dfd4c570bfc4b007322bf775d5a810
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Nov 15 21:18:27 2021 +0100

    ISIS-2894: do not install
    MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified
    
    - as we don't know how to distinguish persistent vs not-persistent
    getters
---
 ...acetForPersistentBigDecimalWhenUnspecified.java | 45 ++++++++++++++--------
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/objectvalue/digits/MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/objectvalue/digits/MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified.java
index 20f39e8..fbbe950 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/objectvalue/digits/MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/objectvalue/digits/MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified.java
@@ -18,6 +18,7 @@
  */
 package org.apache.isis.core.metamodel.facets.objectvalue.digits;
 
+import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.util.Optional;
 import java.util.OptionalInt;
@@ -26,19 +27,20 @@ import org.apache.isis.core.config.beans.IsisBeanTypeRegistry;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
 
-import lombok.val;
-
 /**
  * With {@link BigDecimal}, both JDO and JPA, if left unspecified,
  * default their max-fractional digits to 0.
  * (However, I could not find specific documents to support this claim.)
  *
  * @apiNote This facet should be applied in the absence of a corresponding {@code @Column} annotation,
- * but only for properties of type {@link BigDecimal} that appear within a (persistable) entity.
- * However, entities might extend abstract classes, where the framework - on type introspection -
+ * but only for properties of type {@link BigDecimal} that appear within a (persistable) entity
+ * and are also persistable.
+ * Entities might extend abstract classes, where the framework - on type introspection -
  * cannot distinguish entity from non-entity type.
  * It is safe to assume that mixed-in properties are not to consider here.
+ * @deprecated remove (we don't know how to implement)
  */
+@Deprecated
 public class MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified
 extends MaxFractionalDigitsFacetAbstract {
 
@@ -47,19 +49,23 @@ extends MaxFractionalDigitsFacetAbstract {
             final ProcessMethodContext processMethodContext,
             final IsisBeanTypeRegistry beanTypeRegistry) {
 
-        val cls = processMethodContext.getCls();
-        val facetHolder = processMethodContext.getFacetHolder();
-
-        // only applies in a very specific context, see class java-doc
-        val isApplicable = scaleIfAny.orElse(-1)<0
-                && facetHolder.getFeatureType().isProperty()
-                && processMethodContext.getMethod().getReturnType().equals(BigDecimal.class)
-                && beanTypeRegistry.getEntityTypes().contains(cls);
+        // not properly implemented yet
+        return Optional.empty();
 
-        return isApplicable
-                ? Optional.of(new MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified(
-                        facetHolder))
-                : Optional.empty();
+//        val cls = processMethodContext.getCls();
+//        val facetHolder = processMethodContext.getFacetHolder();
+//
+//        // only applies in a very specific context, see class java-doc
+//        val isApplicable = scaleIfAny.orElse(-1)<0
+//                && facetHolder.getFeatureType().isProperty()
+//                && processMethodContext.getMethod().getReturnType().equals(BigDecimal.class)
+//                && beanTypeRegistry.getEntityTypes().contains(cls)
+//                && isPersistable(processMethodContext.getMethod());
+//
+//        return isApplicable
+//                ? Optional.of(new MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified(
+//                        facetHolder))
+//                : Optional.empty();
     }
 
     private MaxFractionalDigitsFacetForPersistentBigDecimalWhenUnspecified(
@@ -67,4 +73,11 @@ extends MaxFractionalDigitsFacetAbstract {
         super(0, holder);
     }
 
+    // -- HELPER
+
+    private static boolean isPersistable(final Method method) {
+        // TODO don't know how to do that
+        return false;
+    }
+
 }