You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by GitBox <gi...@apache.org> on 2022/09/03 11:40:49 UTC

[GitHub] [isis] andi-huber commented on a diff in pull request #1079: ISIS-3202: Executor does not persist changes

andi-huber commented on code in PR #1079:
URL: https://github.com/apache/isis/pull/1079#discussion_r962143195


##########
core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/entity/EntityFacet.java:
##########
@@ -61,11 +62,16 @@ public String enstringWithCast(final Object primaryKey) {
             .orElseThrow(()->_Exceptions.illegalArgument(
                     "failed to cast primary-key '%s' to expected type %s",
                         ""+primaryKey,
-                        primaryKeyClass.getName()));
+                        primaryKeyClass.getName()))
+            ;
         }
         public T destring(final String stringifiedPrimaryKey) {
             return idStringifier.destring(owningEntityClass, stringifiedPrimaryKey);
         }
+        /** shallow PK detection */
+        public boolean isValid(final Object primaryKey) {
+            return Try.call(()->enstringWithCast(primaryKey)).isSuccess();

Review Comment:
   refactor this into a check that does not produce stacktraces



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@isis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org