title: Is there a more groovy way to implement if..else if..else when checking a multiple instance of an object?
body: <p>I am currently working on something, and I'm thinking if there's a more groovy way to implement this:</p>
  
  <pre><code>if ( reqObj instanceof Order ) {
      params.body = reqObj
  }
  else if ( reqObj instanceof PaymentRequest ) {
      params.requestContentType = ContentType.JSON
      params.body = reqObj
  }
  else if ( reqObj instanceof ShipmentRequest ) {
      params.body = reqObj
  }
  else if ( reqObj instanceof StockLocationRequest ) {
      params.body = reqObj
  }
  else if ( reqObj instanceof StockItemRequest ) {
      params.body = reqObj
  }
  else if ( reqObj instanceof StockMovementRequest ) {
      params.body = reqObj
  }
  else if ( reqObj instanceof ZoneRequest ) {
      params.body = reqObj
  }
  else{
      params.query = reqObj
  }
  </code></pre>
  
  <p>as you can see, I am checking multiple instances of an object that does the same thing, But they need to be checked if they are an instance of that class so they don't do the <code>params.query</code> and do <code>params.body</code> if it returns <code>true</code>. Is there a groovier way to do this?</p>
  
  <p>P.S. I would normally search in google but I'm clueless on what keywords to search.</p>