This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new a018ecd26118 CAMEL-27093: camel-ibm-watsonx-ai - fix compilation, use
the shared BodyFacts.isTextValue
a018ecd26118 is described below
commit a018ecd26118c2cfa37d32b3be652113e950103d
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 26 21:34:53 2026 +0100
CAMEL-27093: camel-ibm-watsonx-ai - fix compilation, use the shared
BodyFacts.isTextValue
#30766 (CAMEL-26553) moved isTextValue from AbstractWatsonxAiHandler into
BodyFacts, while #30888
added a new call to the local method. Make BodyFacts.isTextValue public and
call it from the handler.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java | 2 +-
.../src/main/java/org/apache/camel/support/BodyFacts.java | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git
a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
index bfc570ac1be7..06da1a012e2a 100644
---
a/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
+++
b/components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java
@@ -123,7 +123,7 @@ public abstract class AbstractWatsonxAiHandler implements
WatsonxAiOperationHand
Object element = list.get(i);
if (element instanceof String text) {
inputs.add(text);
- } else if (isTextValue(element)) {
+ } else if (BodyFacts.isTextValue(element)) {
inputs.add(element.toString());
} else {
throw new IllegalArgumentException(
diff --git
a/core/camel-support/src/main/java/org/apache/camel/support/BodyFacts.java
b/core/camel-support/src/main/java/org/apache/camel/support/BodyFacts.java
index b2ac2ecebff0..9529cb36f83c 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/BodyFacts.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/BodyFacts.java
@@ -659,8 +659,14 @@ public final class BodyFacts {
return kindOf(value) != BodyTypeRegistry.Kind.PAYLOAD &&
!isTextValue(value) && text.equals(value.toString());
}
- /** A value whose toString() is its text, rather than a dump of its
fields: an id, an address or a point in time. */
- private static boolean isTextValue(Object value) {
+ /**
+ * Whether the value is one whose toString() is its text, rather than a
dump of its fields: an id, an address or a
+ * point in time (a UUID, URI, URL, java.time value or Date). No type
converter reads these as text otherwise.
+ *
+ * @param value the value, may be null
+ * @return true when the toString() of the value is its text
+ */
+ public static boolean isTextValue(Object value) {
return value instanceof UUID || value instanceof URI || value
instanceof URL || value instanceof Temporal
|| value instanceof TemporalAmount || value instanceof Date;
}