Dhairya-007 opened a new pull request, #30111:
URL: https://github.com/apache/camel/pull/30111

   ## Problem
   
   The compute-parameters header's `javaType` is a sentence of English rather 
than a type:
   
   ```java
   @Metadata(label = "producer", description = "Parameters for APPLY, BROADCAST 
and EXECUTE operations.",
             javaType = "Any object or Collection of objects", applicableFor = 
SCHEME_COMPUTE)
   public static final String IGNITE_COMPUTE_PARAMS = 
"CamelIgniteComputeParameters";
   ```
   
   so the catalog publishes:
   
   ```json
   "CamelIgniteComputeParameters": { ..., "javaType": "Any object or Collection 
of objects", ... }
   ```
   
   Every other header in the same file fills the field with a class name - 
`java.util.UUID`, `org.apache.ignite.lang.IgniteReducer`, 
`org.apache.camel.component.ignite.compute.IgniteComputeExecutionType` - and 
the catalog's `javaType` is consumed as a type elsewhere, by tooling that 
resolves it and by the generated header tables. `Any object or Collection of 
objects` resolves to nothing, and it is the only `javaType` in the whole 
catalog written as prose.
   
   The meaning it is reaching for is right, and the code says it precisely. 
`IgniteComputeProducer` reads the header as a bare `Object`:
   
   ```java
   Object params = 
exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_PARAMS);
   ```
   
   and the APPLY path branches on whether that object is a `Collection`:
   
   ```java
   T params = (T) 
exchange.getIn().getHeader(IgniteConstants.IGNITE_COMPUTE_PARAMS);
   ...
   if (Collection.class.isAssignableFrom(params.getClass())) {
       Collection<T> colParams = (Collection<T>) params;
   ```
   
   ## Fix
   
   Say the same thing in the form the field is for, using the `X or Y` spelling 
Camel already uses for headers that accept more than one type:
   
   ```java
   javaType = "Object or java.util.Collection<Object>"
   ```
   
   Metadata only - no behaviour change, and the header name is untouched. I 
diffed the regenerated catalog file against `main` and confirmed this one 
`javaType` value is the only field that differs.
   


-- 
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]

Reply via email to