开发者

Spring MVC 3.0: Avoiding explicit JAXBElement<> wrapper in method arg

开发者 https://www.devze.com 2022-12-28 03:48 出处:网络
I have the following method and want to avoid having to explicitly show the JAXBElement<> syntax. Is there some sort of annotation that would allow the method to appear to accept raw MessageRespons

I have the following method and want to avoid having to explicitly show the JAXBElement<> syntax. Is there some sort of annotation that would allow the method to appear to accept raw MessageResponse objects but in actuality work the same as shown below? I'm not sure how clear that was so I'll say this: I'm looking for some syntactic sugar :)

    @ServiceActivator
public void handleMessageResponse(JAXBElement<MessageResponse> jaxbResponse) {
    MessageResponse response = jaxbResponse.getValue();
    MessageStatus status = messageStatusDao.getByStoreIdAndMessageId(re开发者_如何学JAVAsponse.getStoreId(), response.getMessageId());
    status.setStatusTimestamp(response.getDate());
    status.setStatus("Complete");
}


You can use the unmarshalling transformer described in the reference guide here.

Adapted from the documentation (usable in a chain):

<si-xml:unmarshalling-transformer unmarshaller="unmarshaller" />

This should give you a domain object as the message payload.

0

精彩评论

暂无评论...
验证码 换一张
取 消