Mappipng unaware @Endpoint implementation (JAXB2)
Hi,
As it's currently implemented, Endpoint implmentation that uses mapping IS compile-time dependent on the mapping type used.
In other words, the Endpoint implementation does not share tha beauty of POJO :)
Code:
(at)PayloadRoot(localPart = "LoadImageRequest", namespace = "...")
public JAXBElement<Image> load(JAXBElement<String> requestElement) throws IOException {
String name = requestElement.getValue();
Image response = new Image();
response.setName(name);
response.setImage(imageRepository.readImage(name));
return objectFactory.createLoadImageResponse(response);
}
The following code would be much more elegant and less verbose.
Code:
(at)PayloadRoot(localPart = "LoadImageRequest", namespace = "...")
public Image load(String name) throws IOException {
Image response = new Image();
response.setName(name);
response.setImage(imageRepository.readImage(name));
return response;
}
It does not look too difficult to create some kind of wrapper arround JAXB2 mapper or (un)marchaler to support the "mapping-less" endpoint implementations.
Does it make sence for you? what do you think?
Thanks
Vitaliy