title: How to do type cast in spring integration expression
body: <p>I'm experimenting with an existing project to use Spring Integration and the requirement is to dynamically call various service activators based on 'type' string value in the payload, And payload data has to be typecast in one of the service activator.</p>
  
  <p>I thought I can do this in the expression like</p>
  
  <blockquote>
    <p>&lt;service-activator input-channel="TEST_CHANNEL" expression="new  TestProcessor().test(**(mypackage.TestData)**payload.data)"></p>
  </blockquote>
  
  <p>But this is giving expression parser error at the time of deployment
  'EL1043E:(pos 156): Unexpected token. Expected 'rparen())' but was 'identifier'"</p>
  
  <p>Here is the test case with more details and code..</p>
  
  <p>Object data = requestItem.getData();
  String type = requestType.getTypeName();</p>
  
  <p>gatewayservice.processRequest(data,type) </p>
  
  <pre><code>&lt;channel id="COMMON_REQUEST_PROCESSOR_CHANNEL"/&gt;
  
  &lt;recipient-list-router id="routerGateway" input-channel="COMMON_REQUEST_PROCESSOR_CHANNEL"&gt;
  
    &lt;recipient selector-expression="payload.type.equals('A')" channel="A_CHANNEL"/&gt;
  
    &lt;recipient selector-expression="payload.type.equals('B')" channel="B_CHANNEL"/&gt;
  
    &lt;recipient selector-expression="payload.type.equals('C')" channel="C_CHANNEL"/&gt;
  
  &lt;/recipient-list-router&gt;
  
  &lt;channel id="A_CHANNEL"/&gt;
  &lt;service-activator input-channel="A_CHANNEL"
          expression="new ClassA().process(payload.data)'"&gt;
  &lt;/service-activator&gt;
  
   &lt;channel id="B_CHANNEL"/&gt;
   &lt;service-activator input-channel="B_CHANNEL" 
          expression="new ClassB().process(payload.data)'"&gt;
   &lt;/service-activator&gt;
  
    &lt;channel id="C_CHANNEL"/&gt;
    &lt;service-activator input-channel="C_CHANNEL" 
          expression="new ClassC().process((**specific class cast required here**)payload.data)'"&gt;
     &lt;/service-activator&gt;
  </code></pre>