[jboss-dev-forums] [JBoss ESB Development] - Annotation based Action classes

Hans Wolffenbuttel do-not-reply at jboss.com
Fri Apr 23 08:34:52 EDT 2010


Hans Wolffenbuttel [http://community.jboss.org/people/h.wolffenbuttel] replied to the discussion

"Annotation based Action classes"

To view the discussion, visit: http://community.jboss.org/message/539213#539213

--------------------------------------------------------------
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
[http://community.jboss.org/message/539213#539213]

Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2032]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100423/6489d7de/attachment.html 


More information about the jboss-dev-forums mailing list