gnodet-bot commented on code in PR #26757:
URL: https://github.com/apache/camel/pull/26757#discussion_r4079603893
##########
components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanExpression.java:
##########
@@ -535,6 +542,40 @@ exchange, describeBean(holder, beanName, exchange),
return newResult;
}
+ /** Says that the bean is not a Map with that key, as null is a value a
key can hold. */
+ private static final Object NO_SUCH_KEY = new Object();
+
+ /**
+ * The value of the key on a Map bean when the method of that name does
not exist, so that ${body.sku} reads the sku
+ * of a map the way ${body[sku]} does - what a map means in jq, JavaScript
and Groovy too (CAMEL-24916).
+ * <p/>
+ * A method still wins: ${body.size} on a Map calls size() as before. A
name that is not a key still fails, so a
+ * misspelled field is still reported.
+ *
+ * @return the value of the key, or {@link #NO_SUCH_KEY} when this is not
that case
Review Comment:
💡 **[Re-raise] Javadoc `@param` tags still missing**
The prior review asked for four `@param` tags on `mapValue()`. Still absent
after this push. The contract of `cause` (why pass the exception rather than
inspecting `resultExchange`?) and `holder` (why nullable?) is non-obvious for
future readers.
```suggestion
* @param holder the bean holder; may be null (treated as no bean)
* @param exchange the current exchange, forwarded to {@link
BeanHolder#getBean(Exchange)}
* @param methodName the OGNL segment that failed as a method call (i.e.
the candidate key name)
* @param cause the exception thrown by the failed method invocation
* @return the value of the key, or {@link #NO_SUCH_KEY} when this is
not that case
```
--
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]