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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]