omarsmak commented on a change in pull request #4630:
URL: https://github.com/apache/camel/pull/4630#discussion_r527009458



##########
File path: 
components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java
##########
@@ -100,7 +101,11 @@ protected void processRequest(Exchange exchange) throws 
SalesforceException {
 
             case SEARCH:
                 // handle known response type
-                exchange.setProperty(RESPONSE_TYPE, 
TypeReferences.SEARCH_RESULT_TYPE);
+                if 
(Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) {

Review comment:
       True, another option is, we can create a common function in the 
`AbstractRestProcessor` that sets response type property for `Json` and `XML`, 
e.g:
   ```
   protected void setSearchResponseType(Object fallbackType) {
   if (Double.parseDouble(endpoint.getConfiguration().getApiVersion()) >= 37.0) 
{
          exchange.setProperty(RESPONSE_TYPE, SearchResult2.class);
   } else {
          exchange.setProperty(RESPONSE_TYPE, fallbackType);
        }
   }
   ```
   
   And then called either 
`setSearchResponseType(TypeReferences.SEARCH_RESULT_TYPE)` or 
`setSearchResponseType(SearchResults.class)`. WDYT?
   




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

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


Reply via email to