Community

Annotation based Action classes

reply from Hans Wolffenbuttel in JBoss ESB Development - View the full discussion

Hi Tom,

 

Does this mean you could have more then one @ProcessMethod with differend parameters where the kind of payload will activate the right one for the job?

 

I will illustrate: Say you have differend kinds of orders: orders-send-by-mail, orders-picked-up-at-location and express-orders. All these orders are converted by unmarshalling it from XML to Java-objects. Then the actionclass would look like:

 

 

public class HandleOrderAction{

 

 

   @ProcessMethod

 

   public OrderAcknowledgment processOrder(MailOrder purchaseOrder){     // Do your thing with the order...

    

     return new OrderAcknowledgment(....);

   }

 

 

@ProcessMethod

 

   public OrderAcknowledgment processOrder(PickupOrder purchaseOrder){     // Do your thing with the order...

    

     return new OrderAcknowledgment(....);

   }

 

 

@ProcessMethod

 

   public OrderAcknowledgment processOrder(ExpressOrder purchaseOrder){     // Do your thing with the order...

    

     return new OrderAcknowledgment(....);

   }

 

 

}

 

 

 

So when an expressorder is placed, the processmethod will call the method with the ExpressOrder as incoming parameter, when a mailorder is placed the method will be called with the MailOrder parameter and so on.

 

Will this work or is this possible in any way?

 

regards,

 

Hans

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community